I have a Pure CSS Dropdown menu in my banner div:
HTML:
<div id="banner">
<h1><a href="http://widerdesign.co.nr/">wider design</a></h1>
<ul id="lang">
<li><a href="index.php">English</a></li>
<li class="drop"><a href="es/index.php">Español</a></li>
<li class="drop"><a href="tw/index.php">中文(繁體)</a></li>
<li class="drop"><a href="cn/index.php">中文(简体)</a></li>
</ul>
</div>
CSS:
/* banner */
#banner {
border-bottom: 1px solid #DDD;
padding: 0 0 15px 0;
margin: 30px 0;
overflow: hidden;
width: 960px;
}
#lang {
padding: 9px 0 0 0;
position: absolute;
}
#lang li.drop {
display: none;
margin: 0 0 0 20px;
}
#lang:hover li.drop {
display: block;
}
When I hover #lang ul
, li.drop
are displayed as block (previously hidden). But here I have the following problems:
#lang
floats to the left side (since it as absolute position I can't float it right).If I position it to the right side (
right: 0;
) it sticks to the browser's window, and it doesn't move along themargin: 0 auto;
.If I use position: relative in
#banner
, and do the option 2, it works but since#banner
hasoverflow:hidden
,li.drop
are not completely displayed.I tried z-index but I'm not sure how it can works in this situation (I assigned
z-index: 100
; toli.drop
didn't work).
Any suggestions?