CSS Descendants?
I have a descendant selector like this ul#navigation{ } So all unordered lists that appear within the navigation div, "do this" I always thought that descendants needed a <space> between each 'Family Member' to trigger a descendant selector. I put a space first between the <ul> and navigation div and it didn't work. I removed the space, and it worked? Don't I need a space to trigger these type of selectors? Thanks David D.... Then if its not a descendant, what is it's proper name? Is it pattern matching? It's just that the 'no space' has thrown me off a little. I thought selectors always required a space weather it is descendants, grouping etc.. match the <ul> element whose ID attribute has the value "navigation"
Public Comments
- That isn't a descendant selector, it will match "An unordered list that has the id 'navigation'". A descendant selector is a space, as you said. ul #navigation would match "An element that has the id 'navigation' that is the descendant of an unordered list". I suspect you want to reverse the order of the components of the selector. Most selectors are made up of several other selectors. 'ul' is a type selector, '#navigation' is an id selector. Pattern matching is how selectors work in general. A space is a descendent selector unless it is next to certain other types of selectors (such as the grouping selector you mentioned).
- That selector will only effect UL elements which have an ID of Navigation. Since each element ID should be unique per page, this selector should only effect one page element. To do what you want, you need to name a div like this: <div id="navigation"> place your ULs here </div> Then you CSS should be: #navigation ul{ } or div#navigation ul{ }
Powered by Yahoo! Answers