- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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?
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.
#nav ul li =
ul#nav li =
ul#nav li could also simply be written like this: #nav li
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?