我打算用这种结构制作一个全宽下拉菜单(我以前从未做过)http://jsfiddle.net/cstEv/
使用我目前拥有的 css,我无法将子导航 ul
居中,因为 ul
定位原点是父级 li
的原点。
有谁知道如何让 ul
.children
在 #menu
div 下居中?
最佳答案
我做了以下更改:
来自:
.children {
display: none;
width: 560px;
min-height: 30px;
position: absolute;
left: -244px;
top: 48px;
text-align: left;
background-color: #c7c7c7;
}
.children li {
position: relative;
float: left;
margin-left: 20px;
}
收件人:
.children{
display: none;
min-height: 30px;
position: relative;
text-align: left;
top: 10px;
}
li:nth-child(3) .children{
right: 252px;
}
li:last-child .children{
right: 502px;
}
li:nth-child(3) .children li {
position: relative;
float: left;
width: 628px !important;
}
li:last-child .children li{
position: relative;
float: left;
width: 628px !important;
}
关于html - 创建全宽下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15072332/