这个问题已经在这里有一个答案:
你知道为什么我无法从我的<li>
元素去掉保证金?浏览器总是添加特定的保证金为我的列表,甚至当我写的代码一定的余量。这里是CSS和HTML代码:
#NavLeftList {
height: 57 % ;
width: 15 % ;
position: absolute;
top: 23 % ;
border-style: none;
background: url(images / heaven.jpg);
margin: 0px
}
#NavLeftList ul {
margin-left: 11 % ;
}
#NavLeftList ul li {
text-align: center;
width: 170px;
list-style-type: none;
text-decoration: none;
margin: 10px 0px 0px 0px;
padding: 1px;
}
#NavLeftList li a {
height: 35px;
padding: 10px 0px 0px 0px;
text-decoration: none;
color: #fff;
background: url(images / tabright.gif);
display: block
}
#NavLeftList li a span {
padding: 0px
}
#NavLeftList li a: hover {
color: #7EC0EE;
}
在这里我没有粘贴HTML代码,因为它是奇怪的出现。
你看到的是不是就li
s保证金,它是在ul
填充。
零出ul
的填充。
尝试list-style-position:inside;
上li
。它可能留下将由即使你设置list-style-type:none;
子弹来填充空间
尝试设置
body{margin: 0;}
或查找NavLeftList包含元素和该元素的余量设置为0,以及。
试试下面的CSS UL
ul { list-style: none; }
尝试利用一个reset.css文件,该文件会重置所有“默认”(因此不同的)填充和利润的实现在不同的浏览器。
例如:CSS Reset