Reputation: 11
I have been try to make this dropdown menu work. I want to space to be between the menus. Tried padding and also the ::after selector.
HTML:
<div id="menu">
<div id="wrapper">
<ul class="navbar">
<li><a href="#">Menu</a>
<ul>
<li><a href="#">Hej 1</a></li>
<li><a href="#">Hej 2</a></li>
<li><a href="#">Hej 3</a></li>
</ul>
</li>
</ul>
</div>
</div>
CSS:
body {
background-color: #efefef;
}
#menu{
height:auto;
position: absolute;
margin: 0px;
}
#wrapper{
position:absolute;
top: 0px;
left:0px;
height: auto;
margin: 0px;
}
#wrapper ul{
margin:0px;
padding: 0px;
height: auto;
width: auto;
background-color: #fff;
border-radius: 8px;
}
#wrapper ul li,#wrapper ul li a, #wrapper ul li ul li, #wrapper li ul li a{
position: relative;
list-style: none;
display: inline-block;
font-size: 14px;
font-family: sans-serif;
text-decoration: none;
color: #808285;
padding: 3px 10px 3px 10px;
transition: all 0.3s ease 0s;
}
#wrapper ul li ul{
display: none;
position: absolute;
top: 20px;
margin-top: 20px;
right: -30px;
width: 150px;
background-color: #FFFFFF;
border-radius: 0px;
transition: all 0.3s ease 0s;
border-radius: 8px;
left: 5px;
}
#wrapper ul li ul li{
position: relative;
top: auto;
left: 0px;
height: auto;
width: 150px;
list-style: none;
display: list-item;
padding: 3px 5px 3px 5px;
margin-top: 5px;
}
#wrapper ul li a:hover, #wrapper ul li ul li a:hover{
color: #ba141a;
}
#wrapper ul li:hover ul{
display: block;
}
#wrapper ul li ul li:hover{
width: 132px;
}
Here is a fiddle: http://jsfiddle.net/yMvg9/1/
Does sombebody knows what the problem is?
Upvotes: 1
Views: 393
Reputation: 76
You have a Top Margin of 20px to
{ #wrapper ul li ul }
#wrapper ul li ul{
display: none;
position: absolute;
top: 20px;
margin-top: 20px; // Remove of Lessen this one...
right: -30px;
width: 150px;
background-color: #FFFFFF;
border-radius: 0px;
transition: all 0.3s ease 0s;
border-radius: 8px;
left: 5px;
}
This would probably solve your problem....
Upvotes: 1
Reputation: 734
maybe because the margin is set to 0. try this working fiddle : http://fiddle.jshell.net/DNQH9/
Upvotes: 0
Reputation: 1878
There is a margin-top: 20px;
on #wrapper ul li ul
wich breaks your hover.
Try this next fiddle: http://jsfiddle.net/skeurentjes/yMvg9/3/
Upvotes: 1
Reputation: 12469
Removing/reducing the margin:20px
from #wrapper ul li ul
should fix that
#wrapper ul li ul{
display: none;
position: absolute;
top: 20px;
margin-top: 20px;
right: -30px;
width: 150px;
background-color: #FFFFFF;
border-radius: 0px;
transition: all 0.3s ease 0s;
border-radius: 8px;
left: 5px;
}
Would!d become
#wrapper ul li ul{
display: none;
position: absolute;
top: 20px;
margin-top:0px; /* or some other value which suits */
right: -30px;
width: 150px;
background-color: #FFFFFF;
border-radius: 0px;
transition: all 0.3s ease 0s;
border-radius: 8px;
left: 5px;
}
Upvotes: 1
Reputation: 5752
Put this code in your stylesheet
#wrapper ul li ul{
background: none;
}
#wrapper ul li ul li{
background-color: #FFFFFF;
}
Upvotes: 0