我有点卡住了。我正在尝试构建一个 1024 像素的水平导航栏,这将允许在其下方显示子菜单。但我希望子菜单的宽度也为 1024 像素,并直接显示在导航栏下方,垂直对齐。
此时子菜单出现,但将其左侧固定在li
您悬停的当前左侧。我怎样才能解决这个问题?
谢谢!
编辑:所以鼠标悬停它看起来像这样:http ://eventav.biz/site/example.jpg
链接到我到目前为止所做的事情 - http://www.eventav.biz/site/
ul.top_menu {
position: relative;
margin: 0;
margin-bottom: -1px;
list-style: none;
display: table;
width: 1024px;
border: 1px solid #111111;
border-bottom: 1px solid #000000;
border-radius: 10px 10px 0px 0px;
}
.top_menu li {
display: block;
position: relative;
border-right: 1px solid #111111;
float: left;
margin: 0px;
display: table-cell;
vertical-align: middle;
}
.top_menu li:first-child {
border-left: 1px solid #111111;
}
.top_menu li a {
display: block;
text-decoration: none;
color: #000000;
text-shadow: 3px 3px 8px #3A3A3A;
padding: 15px;
height: 30px;
display: table-cell;
vertical-align: middle;
margin: 0px;
}
#top_menu_item ul {
display: none;
margin: 0px;
}
#top_menu_item:hover ul {
display: block;
position: fixed;
margin: 0;
}
#top_menu_item:hover li {
width: 1024px;
background-color: #666;
text-align: left;
color: #FFF;
font-size: 12px;
margin: 0px;
}
<ul class="top_menu">
<li id="top_menu_item"><a href="#">HOME</a></li>
<li id="top_menu_item"><a href="#">OUR SERVICES</a>
<ul><li id="top_menu_item"><a href="#">test</a></li></ul>
</li>
<li id="top_menu_item"><a href="#">EXAMPLES OF OUR WORK</a>
<ul><li id="top_menu_item"><a href="#">test</a></li></ul>
</li>
<li id="top_menu_item"><a href="#">CONTACT US</a></li>
</ul>