如何使菜单下拉菜单中的子项目停靠在 li 下而不是在 nav 下
How to make subitem in menu dropdown dock under li not under the nav
我在 css 中制作了一个完全带有下拉菜单的菜单,我很难将子项目停靠在悬停的 li 下。
这是Fiddle
相反,它停靠在整个导航结构下。我知道这与 - top: 100%;
有关
nav ul ul {
background: #2A3E53;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
我该怎么做才能让它停靠在 li 下并推送其余项目,有什么建议吗?
解决方案 来自 Michele Fenu 的回答:
@media only screen and (max-width: 767px) {
nav ul ul {
position: static;
}
}
如果我理解了你的问题,请尝试更改此设置
nav ul ul ul {
position: absolute;
left: 100%;
top:0;
}
进入这个
nav ul ul ul {
position: static;
left: 100%;
top:0;
}
这是一个fiddle
我在 css 中制作了一个完全带有下拉菜单的菜单,我很难将子项目停靠在悬停的 li 下。
这是Fiddle
相反,它停靠在整个导航结构下。我知道这与 - top: 100%;
有关nav ul ul {
background: #2A3E53;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
}
我该怎么做才能让它停靠在 li 下并推送其余项目,有什么建议吗?
解决方案 来自 Michele Fenu 的回答:
@media only screen and (max-width: 767px) {
nav ul ul {
position: static;
}
}
如果我理解了你的问题,请尝试更改此设置
nav ul ul ul {
position: absolute;
left: 100%;
top:0;
}
进入这个
nav ul ul ul {
position: static;
left: 100%;
top:0;
}
这是一个fiddle