|
I can see where your confusion is coming in, but the key thing to consider is not how often you use something, but the nature of the thing itself.
Let's say, for example, that your page is broken up into sections like this (and you're using only divs to define your page structure [otherwise some of the classes below could be replaced with tags]):
i) header
ii) top navigation
iii) left column
iv) center column
v) right column
v) footer
All of those things only occur on a page once and at no point in the future will we consider more than 1 of any of them (e.g. never 2 left columns, 2 footers, etc.). In this case, those things uniquely identify a specific thing, so it's proper to use the CSS id selector, "#".
Now, if the left column and the right column have similar styles, we can give them a class, "column" for example, that will contain the shared attribute settings to reduce the overall file size, but more importantly, to make changing both columns a 1-step process. The CSS class selector is ".". We use a class because more than one thing shares a similar style.
There is an art to this. If you get down to the level where you're creating a class for every attribute, then you've lost focus. If you start assigning classes to groups of characteristics and then need to start customizing many of them, you're not gaining anything from the use of the class and therefore wasting space.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|