ID SELECTORS
The id selector is used to specify a style for a single, unique element.
The id selector uses the id attribute of the HTML element, and is defined with a "#".
The style rule below will be applied to the element with id="slider":
For Example:
#slider {text-align:center; color:red; }
Note: Do not start an ID name with a number! It will not work in Mozilla/Firefox.
The class Selector
The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for many HTML elements with the same class.
The class selector uses the HTML class attribute, and is defined with a "." or dot.
In the example below, HTML elements with class="trailer"
For Example:
.trailer {height:21px; padding:2px 5px 0 5px;}
Now, we have already explained about the different between ID and CLASS selector. I hope you enjoy with this very short article.

No comments:
Post a Comment