Hi!
Should I apply a class or id to body for easy page identification? I heard that there were some bugs for ID. Is that true?
Thanks
| SitePoint Sponsor |


Hi!
Should I apply a class or id to body for easy page identification? I heard that there were some bugs for ID. Is that true?
Thanks





hi,
I wouldnt use this at all unless you need to. Why do you need to identify the page in the code? The only time i use it is so i can provide identification in the navigation of a page as to what page the user is currently on.
If you do need to use it though use id because is the only time you're going to use it. Classes are for rules you want to specify more than once.


It doesn't matter. If you use an ID, just make sure that you don't use the same ID for another element on that page.
I normally prefer to use ID for this, because the CSS selector will then automatically get a high specificity and I don't have to worry about some other rule overriding my declarations.
Birnam wood is come to Dunsinane
Bookmarks