Forums

  • # May 27, 2008 at 1:25 am

    I am trying to understand more difficult stylesheets. I have seen selectors that start like this

    Code:
    div#content

    why do they put the div there first

    I have also seen an id on a li tag where in the css they did this

    Code:
    ul li

    I guess what i am trying to get at is if you need to specify the parent tag then go through all the child tags untill you get to the id tag. or is it that if you list the parent and then the children that you are trying to target a specific tag. I tried some experiments but the end result didn’t match what I though i would get.

    does that make any sense?

    # May 27, 2008 at 9:13 am

    Also, if you’re using div#idnamehere, you raise the ID’s specificity by 1. Not much, but sometimes it’s good to be sure.

    If you want to learn more about CSS specificity, I recommend reading this article and then test out the calculator.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag