Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS tag#id vs #id

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23018

    I was wondering why in some cases just the #id is used, but in some other cases tag#id is used. It makes sense to me for classes since you can have multiple classes in a page, but not for ids. It’s probably a beginner’s question, but that’s what I am. :D

    To take it further, sometimes I see things like this:
    body#pagewrap ul#nav li.contact a

    Why not start that from the li or ul if needed?

    These things are still kinda confusing for me, but I’m getting there in my CSS journey.

    Thanks!

    #48837

    Ok, that makes total sense. It’s all about the specificity. I think it was just throwing me off sometimes seeing declarations with a bunch of tags, and looking over their whole document they didn’t need to go that far. Maybe they’re being specific for future changes, who knows.

    Thanks for the clarification. :thumbsup:

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.