Tag: The id Selector
The id Selector
by Sagar Awasthi on May.28, 2009, under DIV/CSS, The id Selector, Web 2.0 Technology
You can also define CSS styles for HTML elements with the id selector. The id selector is defined with #. It has a Unique effect in HTML Document, as it is defined uniquely for each HTML Tag/Element.
The CSS style rule defined below will go with the element that has an “id” attribute with a value of “mycolor”:
# mycolor {color:green}
The style rule below will compare the “li” element that has an id with a value of ” link1″:
li#link1
{
text-align:center;
color:red
}
Again Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.
CSS Comments
Comments are used to distribute your code among the working tags and your comments. It may help you when you edit the source code at a later date to recognize the part of code from the content present in your comments. A comment is ignored by browsers. A CSS comments starts with “/*”, and ends with “*/”, like this:
/*This is a comment*/
