Whenever I hover on the menu item, it turns on the hover background + opens up drop down menu.
but whenever I hover the dropdown, the background goes off?
examples and how should it look like this
see Live preview
Also as you see the box shadow goes over it.
Codes:
My menu html:
<div class="secondheader">
<div class="container">
<div class="span12">
<ul class="nav6">
<li><a href="#">Home</a></li>
<li class="dropdown1"><a href="#">Categories</a>
<ul>
<li class="substyle"><a href="#">Buy</a></li>
<li class="substyle"><a href="#">Sell</a></li>
<li class="substyle"><a href="#">Forums</a></li>
<li class="substyle"><a href="#">Contact</a></li>
<li class="substyle"><a href="#">item 1</a></li>
<li class="substyle"><a href="#">Forums</a></li>
<li class="substyle"><a href="#">Contact</a></li>
<li class="substyle"><a href="#">item 1</a></li>
</ul>
</li>
<li><a href="#">Buy</a></li>
<li><a href="#">Sell</a></li>
<li><a href="#">Forums</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">item 1</a></li>
<li><a href="#">Forums</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">item 1</a></li>
</ul>
</div>
</div>
</div>
</div>
My css of menus:
.nav6 {
list-style: none;
font-family: 'Dosis', sans-serif;
float: left
font-size: 20px;
margin-top: 13px;
margin-left: -35px;
}
.nav6>li>ul{
display:none;
position:absolute;
background:white;
overflow:hidden;
width: 150px;
background: #fbf2d3;
margin-top: 20px;
margin-left: -3px;
-webkit-box-shadow: 0px 1px 5px 0px #dadada;
box-shadow: 0px 1px 5px 0px #dadada;
}
.nav6>li:hover>ul {
display:block;
}
.nav6 >li {
display: inline;
margin: 0px;
font-size: 18px;
font-family: 'Dosis', sans-serif;
float: left;
margin-top: 10px;
}
.substyle {
padding: 10px;
}
.substyle:hover {
background: #f54922;
padding: 10px;
-webkit-border-radius: 6px;
border-radius: 6px;
color: #fff;
}
.subsyle a:hover {
color: #fff;
}
.nav6>li>a {
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
}
.nav6 a{color: #7D7253;}
.nav6 a:hover {
color: #fff;
text-decoration: none;
}
.nav6 > li > a:hover {
background-image: url("../img/hoverbg.png");
}
Question: What does > selectors do exactly? could you please explain me that with an easy example? thank you very much!
You need to add a class that shows the hover image when you’re hovered on the whole li, not just the child li. Try changing your last style to this:
Also, the > selector is saying specifically a “direct child” of the parent. So if you have this:
Then this will apply to all the spans:
This will apply to only the second span:
Either of these will apply to only the first span:
In the last case, you wouldn’t use the > – only use it if you specifically need to target only the direct child.