我有一个垂直菜单,我想要横向。我试过放置display:inline tag但是它没有完成这项工作。请指导。感谢。
#access div {
margin: 0;
width:140px;
}
#access {
clear: both;
display: block;
float: left;
}
#access ul {
font-size: 11px;
list-style: none;
margin: 0;
padding: 0;
}
#access li {
line-height: normal;
position: relative;
display:inline;
}
#access a {
color: #B25326;
display: block;
padding: 4px 0;
text-decoration: none; font-size: 10px;
text-align:right; text-transform:uppercase;
line-height: normal;
}
#access a:hover {
color: #000000 !important;
}
#access ul ul {
-moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
box-shadow: 0 3px 3px rgba(0,0,0,0.2);
display: none;
float: left;
margin: 0;
position: absolute;
top: 3.333em;
left: 0;
width: 188px;
z-index: 99999;
}
#access ul ul ul {
left: 100%;
top: 0;
}
#access ul ul a {
background: #f9f9f9;
border-bottom: 1px dotted #ddd;
color: #444;
font-size: 13px;
font-weight: normal;
height: auto;
line-height: 1.4em;
padding: 10px 10px;
width: 168px;
}
#access li:hover > a,
#access ul ul :hover > a,
#access a:focus {
background: none;
}
#access li:hover > a,
#access a:focus {
color: #000000;
}
#access ul li:hover > ul {
display: block;
}
#access .current-menu-item > a,
#access .current-menu-ancestor > a,
#access .current_page_item > a,
#access .current_page_ancestor > a {
font-weight: bold;
}
答案 0 :(得分:1)
首先从div中取出宽度然后你可以使用:
#access li {
float:left;
}