我试图找出一个编码作为一个新手。想知道# 符号在代码中的含义或代表什么,例如#55555
数字。或者#menu1
在一个div中:div#menu1 ul.rMenu
?
试图重新接受教育
我试图找出一个编码作为一个新手。想知道# 符号在代码中的含义或代表什么,例如#55555
数字。或者#menu1
在一个div中:div#menu1 ul.rMenu
?
试图重新接受教育
# is used for elements with some id.
<div id="menu"> ====> div#menu
. for class
<div class="menu"> ====> div.menu
# refers to hex code
i think in case of #55555
, #
indicates hexadecimal code and in case of #menu1
, #
indicates menu1
is an ID attribute..
Like many symbols used in programming, the meaning of the symbol is different in different contexts. Below are a few examples:
In general the examples that you're mentioning look like they're from CSS, so feel free to look up CSS:
我认为人们对这个问题的理解有点过于字面意思,并为这两种情况提供了答案。
#
在源代码中没有全局约定。它是一个没有常规用法的标点符号,并且与英语中常用的任何内容都没有密切关联,因此它在编程语言中得到了很多重用。
它通常用于注释行(Ruby、Perl、Python 等):
if foo
# Do something for foo.
end
它在 C 和 C 派生语言中用于控制预处理器:
#include <stdio.h>
除了已经涵盖的 CSS 和 HTML 用法。
有关其他编程语言中许多其他用途的链接,请参见Wikipedia 。
A. Not Code your talking about CSS http://www.html.net/tutorials/css/lesson1.php
B. Your talking about its use in 2 different instances.
#55555
refers to a color. The # before the number says .. Hey I'm going to tell you a colour now
#menu1
refers to a specific ID.
This basically means select an element with that id from in a div
For ex.
<div>
<div id="menu1">
Hi
</div>
</div>
And the CSS would be something like (Color this red)
div #menu1{
color:#550000;
}
#55555 - Hexadecimal Number.
#menu1 - id of element
div#menu1 - id of element div.