为什么遵循 CSS-Code 没有填满 100% 的屏幕?我有 5 列,宽度为 20%,向左浮动。
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style type="text/css" media="screen">
body {
padding: 0;
margin: 0;
}
#container {
width: 100%;
background-color: red;
height: 42px;
}
ul {
padding: 0;
margin: 0;
width: 100%;
overflow: hidden;
list-style-type: none;
float: left;
white-space: nowrap;
display: inline;
height: 42px;
}
li {
float: left;
width: 20%;
padding: 0;
background-color: #000000;
display: inline;
}
a {
text-decoration: none;
color: #333;
text-align: center;
display: block;
height: 42px;
line-height: 42px;
white-space: nowrap;
overflow: hidden;
font-size: 0.9em;
width: auto;
}
a:hover {
background-color: #ccc;
color: #FFF;
}
</style>
</head>
<body>
<div id="container">
<ul>
<li>
<a href="#">Home</a>
</li>
<li>
<a href="#">Services</a>
</li>
<li>
<a href="#">Portfolio</a>
</li>
<li>
<a href="#">Clients</a>
</li>
<li>
<a href="#">Articles</a>
</li>
</ul>
</div>
</body>
右侧总是有一个红色区域,但 5*20% = 100% 所以不可能。怎么了?
亲切的问候,PP