如何以li
这种方式增长元素,所有四个li
元素都占用完整的 900 像素空间并在元素之间添加一点间隙。为什么现在已经存在差距 - 我没有定义?
<html><head><title></title></head>
<style type="text/css">
#box { width: 900px; border: solid 1px black; }
#menu {
display: block;
position: relative;
width: 900px;
margin: 0;
padding: 0;
text-align: center;
}
#menu li {
display: inline;
position: relative;
margin: 0;
padding: 0;
}
#menu li a, #menu li a:visited {
display: inline-block;
position: relative;
padding: 10px;
background-color: yellow;
text-decoration: none;
}
#menu li a:hover, #menu li a:active {
background-color: green;
text-decoration: none;
color: white;
}
</style>
<body>
<div id="box">
<ul id="menu">
<li><a href="#">Mozilla Firefox & Thunderbird</a></li>
<li><a href="#">OpenOffice</a></li>
<li><a href="#">Microsoft Office Visio</a></li>
<li><a href="#">Apache OpenOffice 3.0.0</a></li>
</ul>
</div>
</body>
</html>