SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    eez
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I apply a class or id to body?

    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

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •