Give help. Get help.

  • # November 29, 2009 at 9:01 pm

    I never really did understand the order in css selection. or maybe I just forgot. I was just trying to set my nav to disply inline and it wouldn’t work, I did get it, but I tried

    #nav ul li { display: inline; }

    This did not work. I had to use

    ul#nav li

    Why did I need to do it that way? What is the rule here?

    # November 29, 2009 at 10:05 pm

    ul#nav selects a UL with the ID=nav

    #nav ul selects a UL that is nested inside another element with the ID=nav.

    *shameless advertising* Here’s a short CSS Selector Tutorial I made on how selectors work.

    # November 30, 2009 at 12:40 pm

    #nav ul li =


    ul#nav li =


    ul#nav li could also simply be written like this: #nav li

    # November 30, 2009 at 2:51 pm

    Here’s how those selectors work. The space is basically referring to nested elements, so div#cheese p can be read as "p inside of the div with the id of cheese". If you want to say for instance, "div with the id of cheese", it’s written as above ie div#cheese. Also, this works for classes, so div.cheese would be read as "div with the class of cheese". Does that make sense?

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

You must be logged in to reply to this topic.