Greensboro | High Point | Winston-Salem | Burlington | Raleigh | Durham

Since 2003


Tutorial Series: CSS ID’s and Classes

There are two kinds of tags used in CSS to control the look of your page. One is the ID, the other is the Class. ID’s should only be used once on a page and they have status over Classes, which can be re-used any number of times. ID’s get really useful when you want to use the same class over and over again in different situations, and sometimes you went it to do one thing, while, in some cases, do another. By combining, say a

class tag (standard class for a paragraph) with an ID I’ve made up of say, id=”home-page-first” I can style the first paragraph on the first page of my site to look differently than any other. I had struggled for awhile trying to understand all this, none of my searching online, or the books I’d read, including Grand Master, Eric Meyer’s book, seemed to have the answer. It wasn’t until FINALLY, I was doing a little coding via my Firebug that it became obvious. This is why I so strongly recommend using Firebug. It will greatly accelerate your understanding of CSS.