The three main methods for applying styles are as follows:
idclassThis is the method with the broadest application, because it affects all instances of the given element. For example, you could assign a certain style to all paragraphs, all links, all unordered lists, or any other element.
idThis method applies the style to only one item on the page, because each id must
be unique, and only one item per page can have that id. For example, if you have a paragraph with an id of "unique" (<p id="unique">), you could assign styles just to that paragraph.
classThis method can be used to apply the same style to an unlimited number of items on the page, by assigning the same class to the items that you want to receive the style. For example, you might have two paragraphs that you want to assign a certain style two. You can do this by giving them the same class.
<p class="highlight">This paragraph will be highlighted.</p><p class="highlight">This paragraph will also be highlighted</p>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.