Ref this tutorial: https://www.servage.net/blog/2009/03/20/create-a-cool-css-based-drop-down-menu/
I used an external stylesheet, and simply put #menu before each CSS item, like this:
#menu ul{
font-family: Arial, Verdana;
font-size: 14px;
margin: 0;
padding: 0;
list-style: none;}
or:
#menu ul li{
display: block;
position: relative;
float: left;}
But, when i reference with #menu, the menu doesn’t render properly. It leaves the parent ‘li’ untouched by CSS.
Any ideas?
Thx,
Dave
#menu ultargets this (anyulinside of an element withid='menu')…(
divis just an example, any element withid="menu"can be used above)ul#menutargets this (theulwithid='menu')…Edit as per comments:
Quote: “…i am missing the ‘box’ around the parent node.”
I think the node to which you refer is the
<li>, just inside the parent<ul id='menu'>, and you have not targeted it anyplace at all.Just add
ul#menu li ato your box styling. (Note the comma. It separates two totally unique selectors sharing the same styling.)http://jsfiddle.net/cWpEg/1/
See the difference?
ul#menuis the parent.ul#menu liis the first item inside the parent.ul#menu li ais the link inside the first child of the parent.Since
ul#menu litargets any & all<li>‘s that are children of theul#menuparent, you would only need the one selector…http://jsfiddle.net/cWpEg/2/
Also note how it’s the full width of the screen.
To target & style just the parent, add something like this.
http://jsfiddle.net/cWpEg/6/