I have started making this webpage with a hover menu of flags ment for changing language of my webpage.
there are three flags displayed. This is a hover where the danish and german flag will only appear when i hover over the british flag.
This however creates a problem because there is a gab between the flags of 10 pixels. and as soon as the cursor leaves the british flag then the hover menu disapears. I need some kind of delay that will make the hover effect stay true for 1-2 sec after the cursor leaves area of effect. So that i can reach the danish and german flag.
My Html Code:
<div id="nav">
<ul style="list-style:none;">
<li><img id="England" src="England.png">
<ul style="list-style:none;">
<li><img id="Denmark" src="Denmark.png"></li>
<li><img id="Germany" src="Germany.png"></li>
</ul>
</li>
</ul>
</div>
My CSS code:
#nav ul li:hover ul{
display: block;
}
#nav ul ul{
display: none;
}
#England{
image-size:absolute;
height:60px;
width:86px;
position: absolute;
top:10px;
left:524px;
}
#Denmark{
image-size:absolute;
height:60px;
width:86px;
position: absolute;
top:80px;
left:524px;
}
#Germany{
image-size:absolute;
height:60px;
width:86px;
position: absolute;
top:150px;
left:524px;
}
I have tried using transition-delay:1s; but without luck. is there any brilliant minds out there that can help me out?
The answer is not to position all the the list items individually but rather the grouping of them in the parent
ul
.By applying
position:absolute
andtop:100%
, the submenu will always be below the parentli
without any gap regardless of how tall the parentli
is.Absolute positioning is a very poor layout method and should only be used for specific effects. It has its place but nudging every element into exactly the right spot isn't it. This might help LearnLayout.com