id vs class

trebor

New Member
Messages
35
Reaction score
0
Points
0
Had a big discussion about this today in one of the classes I attend.

When using CSS is there a specific standard for when you use class vs id?

I have always tended to use more classes than ids but thats could just be me...

The concensus of the class was that it didn't matter, but I'm curious to see what others might think..
 

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
id is only meant to be used once per page (Otherwise you get a validation error or warning thrown up - not sure which it is)
class can be used once or more per page.
So having id="blah" twice on a page is technically incorrect.
However class="blah" twice on a page is OK.

I believe there was a thread very similar to this recently.
 
Top