HTML is as Follows
<ul id="master">
<li class="has-sub">Item</li>
<ul class="sub">
<li>Sub One</li>
</ul>
</li>
</ul>
CSS is
.sub { visibility: hidden; }
#master .has-sub:hover > .sub { visibility: visible;}
I pretty much took the approach from a site where this works, but on my adventure the hero fails. Badly. What am I doing wrong?
Your HTML is invalid...you have closed <li class="has-sub">Item</li
> too soon.
.sub {
visibility: hidden;
}
#master .has-sub:hover > .sub {
visibility: visible;
}
<ul id="master">
<li class="has-sub">Item
<ul class="sub">
<li>Sub One</li>
</ul>
</li>
</ul>
First your html is invalid please fix that And Try this Change your html to
<ul id="master">
<li class="has-sub">Item
<ul class="sub">
<li>Sub One</li>
</ul>
</li>
</ul>
.sub {
visibility: hidden;
}
#master .has-sub:hover > .sub {
visibility: visible;
}
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With