Is there a way to detect if an element is a primary child of an element using pseudo-classing in CSS?
By 'primary child', I don't mean 'first-child', or the first node, but rather the top-level node of an element, the 'immediate children'.
I'm asking to see if there's a simple way to handle my drop-down menus, which is based off of the
Suckerfish tutorial.
What the CSS for sub-menus currently is:
#nav li ul {
display: none;
position: absolute; left: 200px; top: 0;
}
#nav li:hover ul, #nav li.over ul {
display: block;
}
What I'm shooting for:
[The solution]
#nav li > ul {
display: none;
position: absolute; left: 200px; top: 0;
}
#nav li:hover > ul, #nav li.over > ul {
display: block;
}
Does CSS already have this? Am I being blind, and does first-child do exactly this?
EDIT: Skimmed over some of CSS stuff at W3Schools again, and nothing jumped out at me.
EDIT: Source updated
[Edited by - deadimp on June 1, 2007 11:25:01 AM]