[UPHPU] More CSS frustration
Wade Preston Shearer
lists at wadeshearer.com
Wed Jan 17 09:34:33 MST 2007
> I know I said one question but I can't resist. Just one more
> question.
> What are the guidelines for using the id or class attributes? When
> should
> you use one instead of the other? In other words, why not use all
> ids or
> all classes? What are the pros and cons of each? (Sorry, I got
> carried
> away. That's more than one question)
IDs are finger prints [1]. Classes are names. Use IDs sparingly, but
powerfully. You can only use IDs once. Use names to address multiple
things.
<div id="left_col" class="col"></div>
You only have one left column on the page. Although you have a right
and a left column, attributes that they both share can be declared
with a class.
[1] I was going to compare them to social security numbers, but we
all know that in today's society each of us has at least one illegal
immigrant sharing out social security number.
More information about the UPHPU
mailing list