gpt4 book ai didi

html - CSS:下拉菜单未正确选择;边距间距?

转载 作者:太空宇宙 更新时间:2023-11-04 12:22:16 26 4
gpt4 key购买 nike

我有一个下拉菜单,当您将鼠标悬停在一个选项上时,它会显示子菜单,但是当您向下移动光标时;有时菜单的其余部分会隐藏。我注意到下面有一点空间(边距?边框?),除非有人能告诉我不同​​的说法,否则我认为这是罪魁祸首。

下面是一张图片来说明我的意思;这两个选项之间有一个小差距,我假设当你让光标越过那个点时它会“悬停”并隐藏它

如有任何帮助,我们将不胜感激。

enter image description here

.menu ul { margin = ..;}

上面的代码使边距变大了,但是即使它被设置为 0 它似乎仍然存在..

这是我的菜单 HTML

<td align="center" bgcolor="#666666">
<div class="menu" align="center">
<ul>
<li><a href="/barequipment" class="dropmenutext">Bar Equipment</a>
<ul>
<li><a href="/barequipment/tills">Tills</a></li>
<li><a href="/barequipment/furniture">Bar Furniture</a></li>
<li><a href="/barequipment/sundries">Bar Sundries</a></li>
...
</div></td>

这是菜单类的CSS

 @charset "utf-8";

* {
margin: 0px; padding: 0px;
}

.menu {
margin: 0px;
text-align: center;
background: #efefef;
padding: 0px;
}

.menu ul ul {
display: none;
}

.menu ul li:hover > ul {
display: block;
}

.menu ul {
background: #efefef;
padding: 0;
list-style: none;
position: relative;
display: inline-table;
margin: 0px;
}
.menu ul:after {
content: "";
clear: both;
display: block;
}

.menu ul li {
float: left;
}

.menu ul li:hover {
background: #999;
}
.menu ul li:hover a {
color: #fff;
}

.menu ul li a {
display: block;
padding: 10px;
color: #757575;
text-decoration:none;
}

.menu ul ul {
background: #efefef;
padding: none;
position: absolute;
top: 100%; /* ?? */
}
.menu ul ul li {
float: none;
border-top: 0px solid #6b727c;
border-bottom: 0px solid pink;
position: relative;
}
.menu ul ul li a {
padding: 10px;
color:#fff;
display: block;
}

.menu ul ul li a:hover {
background: red;
}

.menu ul ul ul {
position: absolute;
left: 100%;
top:0;
padding: 0;
}

.menu ul ul ul li {
float: none;
border-top: 0px solid #6b727c;
border-bottom: 0px solid pink;
position: relative;
}

.menu ul ul ul li a {
padding: 10px;
color: #fff;
}

.menu ul ul ul li a:hover {
background: red; */
}

.menu ul ul ul ul {
position: absolute;
left: 100%;
}

最佳答案

查看 jsfiddle:http://jsfiddle.net/p1kuzzdo/

试试这个 CSS:

 @charset "utf-8";

* {
margin: 0px; padding: 0px;
}

.menu {
background: none repeat scroll 0 0 #efefef;
height: 50px;
line-height: 50px;
margin: 0;
padding: 0;
text-align: center;
}

.menu ul ul {
display: none;
}

.menu ul li:hover > ul {
display: block;
}

.menu ul {
height: 50px;
line-height: 50px;
list-style: outside none none;
margin: 0;
padding: 0;
position: relative;
text-align: center;
}
.menu ul:after {
content: "";
clear: both;
display: block;
}


.menu ul li {
float: left;
padding: 0 10px;
}

.menu ul li:hover {
background: #999;
}
.menu ul li:hover a {
color: #fff;
}
.menu ul li a {
color: #757575;
display: block;
text-decoration: none;
}
.menu ul ul {
background: none repeat scroll 0 0 #efefef;
padding: 0;
position: absolute;
top: 100%;
}
.menu ul ul li {
border-bottom: 0 solid pink;
border-top: 0 solid #6b727c;
float: none;
margin: 0;
padding: 0;
position: relative;
}
.menu ul ul li a {
padding: 10px;
color:#fff;
display: block;
}

.menu ul ul li a:hover {
background: red;
}

.menu ul ul ul {
position: absolute;
left: 100%;
top:0;
padding: 0;
}

.menu ul ul ul li {
float: none;
border-top: 0px solid #6b727c;
border-bottom: 0px solid pink;
position: relative;
}

.menu ul ul ul li a {

color: #fff;
}

.menu ul ul ul li a:hover {
background: red; */
}

.menu ul ul ul ul {
position: absolute;
left: 100%;
}

关于html - CSS:下拉菜单未正确选择;边距间距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28275620/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com