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*/

  • Share/Save/Bookmark
2 Comments :, , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...