【发布时间】:2014-07-14 14:55:41
【问题描述】:
我制作了这个水平菜单,一切都很好,直到我意识到我无法让子菜单显示为垂直,有人可以帮助我吗?
这里是菜单代码:
<div id="nav_custom">
<div id="nav_custom_wrapper"></div>
<ul>
<li><a href="#">NEW ARRIVALS</a>
</li>
<li>
<a href="#">SEQUIN DRESSES</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
</li><li>
<a href="#">BOHO DRESSES</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
</li><li>
<a href="#">MOD DRESSES</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
</li><li>
<a href="#">PSYCHEDELIC DRESSES</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
</li><li>
<a href="#">COATS & JACKETS</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
<li>
<a href="#">KIMONOS</a>
<ul id="nav_custom_sub">
<li><a href="#">AVAILABLE</a></li>
<li><a href="#">EXAMPLES SOLD</a></li>
</ul>
</li>
</ul>
</div>
这是我用过的css:
#nav_custom {
text-decoration: none;
font-family: 'Source Sans Pro', sans-serif;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 49px;
color: #000;
display: block;
padding: 10px;
width: 960px;
margin-left: -35px;
margin-right: auto;
text-align: center;
width: auto;
}
#nav_custom_wrapper {
width: 960px;
margin-left: auto;
margin-right: auto;
text-align: center;
}
#nav_custom ul{
list-style-type: none;
padding: 0;
margin: 0;
position: relative;
}
#nav_custom ul li{
display: inline-block;
}
#nav_custom ul li:hover{
color: #000;
text-decoration: none;
}
#nav_custom ul li a,visited{
color: #BA7145;
padding: 15px;
text-decoration: none;
}
#nav_custom ul li a:hover{
color: #000;
text-decoration: none;
}
#nav_custom ul li:hover ul{
display: block;
}
#nav_custom ul ul{
display: none;
position: absolute;
margin-top: -25px;
margin-left: -50px;
text-align: center;
color: #4f4f4f;
}
【问题讨论】:
标签: css drop-down-menu navigation navbar