3

我试图找出一个编码作为一个新手。想知道# 符号在代码中的含义或代表什么,例如#55555数字。或者#menu1在一个div中:div#menu1 ul.rMenu

试图重新接受教育

4

6 回答 6

1
# is used for elements with some id.

<div id="menu"> ====> div#menu

. for class

<div class="menu"> ====> div.menu

# refers to hex code

于 2013-05-13T05:16:00.130 回答
1

i think in case of #55555 , # indicates hexadecimal code and in case of #menu1 , # indicates menu1 is an ID attribute..

于 2013-05-13T05:16:02.763 回答
1

Like many symbols used in programming, the meaning of the symbol is different in different contexts. Below are a few examples:

  • #555555 means a colour (grey in this case) in hexadecimal notation.
  • #menu1 means any tag with the id "menu1".
  • Also other contexts, such as in Cold Fusion #name# means insert the variable named "name".

In general the examples that you're mentioning look like they're from CSS, so feel free to look up CSS:

http://www.w3schools.com/cssref/

于 2013-05-13T05:18:32.157 回答
1

我认为人们对这个问题的理解有点过于字面意思,并为这两种情况提供了答案。

#在源代码中没有全局约定。它是一个没有常规用法的标点符号,并且与英语中常用的任何内容都没有密切关联,因此它在编程语言中得到了很多重用。

它通常用于注释行(Ruby、Perl、Python 等):

if foo
  # Do something for foo.
end

它在 C 和 C 派生语言中用于控制预处理器:

#include <stdio.h>

除了已经涵盖的 CSS 和 HTML 用法。

有关其他编程语言中许多其他用途的链接,请参见Wikipedia 。

于 2013-05-25T18:31:15.593 回答
0

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.

  1. #55555 refers to a color. The # before the number says .. Hey I'm going to tell you a colour now

  2. #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; 
}
于 2013-05-13T05:18:58.060 回答
0
#55555 - Hexadecimal Number.
#menu1 - id of element
div#menu1 - id of element div.
于 2013-05-13T05:15:44.247 回答