css - 我的 CSS 菜单在 Wordpress 中出现 Overflow-X

标签 css wordpress html-lists scrollbar overflow

当我将鼠标悬停在菜单项上时,我的 CSS 菜单会打开和关闭浏览器的水平滚动条。我尝试了各种 css 组合来处理溢出问题;

overflow-x:hidden;

overflow-y: auto;

但这些只是切断了我在菜单中的下拉元素,并在我的菜单中放入了一个滚动条。

这是我的菜单源代码:

/* Main Menu*/
#menu {
font-family: 'sharetech', sans-serif;
float: right;
height: auto;
font-size: 18px;
padding: 0;
margin: 14px 0 0 0;
}
#menu a {
display: block;
line-height: 1em;
text-decoration: none;
color: gray;
padding: 2px 10px;
}
#menu:after, #menu ul:after {
content: '';
display: block;
clear: both; 
}
#menu ul, #menu li {
list-style: none;
margin: 0;
padding: 0;
}

#menu ul {
position: relative;
z-index: 597;
}
#menu ul li {
float: left;
min-height: 1px;
vertical-align: middle;
}
#menu ul li.hover,
#menu ul li:hover {
position: relative;
z-index: 599;
cursor: default;
}
#menu ul ul {
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
z-index: 598;
width: 100%;
}
#menu ul ul li {
float: none;
}
#menu ul ul ul {
border-top: 0 none;
top: 0;
left: auto;
right: -99.5%;
}
#menu ul li:hover > ul {
visibility: visible;
}
#menu ul ul {
bottom: 0;
left: 0;
margin-top: 0;
border-top: 4px solid #1b9bff;
text-transform: none;
min-width: 190px;
}
#menu ul ul a{
background: #1b9bff;
color: #FFF;
border: 1px solid #0082e7;
border-top: 0 none;
line-height: 150%;
padding: 10px 10px;
}
#menu ul ul li {
font-weight: normal;
position: relative
}
#menu > ul > li > a {
line-height: 48px;
}
#menu ul ul li:first-child > a {
border-top: 1px solid #0082e7;
}
#menu ul ul li:hover > a {
background: #35a6ff;
}
#menu ul ul li:last-child > a {
border-radius: 0 0 3px 3px;
box-shadow: 0 1px 0 #1b9bff; 
}
#menu ul ul li:last-child:hover > a {
border-radius: 0 0 0 3px;
}
#menu ul ul li.has-sub > a:after {
position: absolute;
top: 50%;
right: 15px;
margin-top: -8px;
}
#menu ul li:hover > a, #menu ul li.active > a {
background: #1b9bff;
color: #FFF;
}
#menu ul li.has-sub > a:after {
margin-left: 5px; 
}
#menu ul li.last ul {
left: auto;
right: 0; 
}
#menu ul li.last ul ul {
left: auto;
right: 99.5%;
}

最佳答案

你是对的 Nix,它在伪类中。我想是的,这是缺少的东西;

#fmenu ul ul li {
float: none;
width: 190px; <----set width
}

我在这里定义了一个设置宽度,它解决了这个问题。

关于css - 我的 CSS 菜单在 Wordpress 中出现 Overflow-X,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21766595/

相关文章:

html - 将 Wordpress 网站转换为静态 html?

css - 在wordpress中自动延续有序列表

html - 将背景图像应用于多个 <li>

html - 更改 <div> 宽度而不影响边距为 :auto 的内容

javascript - wordpress子主题中错误的排队脚本顺序

css - 如何动态地向元素添加新类?

html - 如何编辑 Wordpress 菜单以制作两行菜单?

html - 当我使用 CSS 动态链接单击它时,如何使菜单被选中?

css - Snappy Laravel PDF 导出不加载 CSS

css - 如何正确实现固定侧边栏?