Jump to content

ul ul ul?


sepoto

Recommended Posts

This looks so odd! Why is 'ul' stated three times? I do not understand this code at all.

div#menu ul ul ul a {font-style:italic;}

Link to comment
Share on other sites

That selector targets anchors which are in unordered lists, which are in unordered lists, which are in unordered lists, which are in the division with ID "menu". This may be used, for example, if you have a list of links or a dropdown menu three levels deep, and want to target only the links at the third level.

Link to comment
Share on other sites

This may be used, for example, if you have a list of links or a dropdown menu three levels deep, and want to target only the links at the third level.
... and deeper levels, if any (in the way this is written).
Link to comment
Share on other sites

How did you determine that it may style tags deeper than three levels?
A space is the "descendant" selector meaning it will target all elements contained in the parent regardless of how deeply they are nested.A > sign is the "child" selector which will only target direct descendants, meaning it will not go any deeper than the first nested level.
Link to comment
Share on other sites

Selectors separated by spaces only indicate that one is an ancestor of the next one. There is no limit to the number of elements that can be nested between them.ul ul targets ANY ul nested inside the first ul. In theory, the second ul could be nested 20, 30, an infinite number of levels deep, and any number of intermediate elements could also be ul elements.ul>li>ul is much more specific. It targets a ul that is the child of an li that is the child of a ul. No intermediate elements.EDIT. Sometimes it's like a race around here.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...