我正在尝试在宽度为 940 像素的容器中放置四列http://jsfiddle.net/thiswolf/D3Z6g/但这些列并不完全适合。每列都有 220 像素和 20 像素的右边距,所以理想情况下它们应该适合好吧,如果我删除最后一列的右边距,但即使在那之后,它们也不适合。最后一列短了 12 像素。
我的浏览器是 Firefox 12
这是html
<!Doctype html>
<head>
<meta charset="uft-8">
<title>Four Columns Portfolio</title>
<style type="text/css">
.container{
width:940px;
border:1px dotted red;
height:auto;
}
li.portfolio{
display:inline-block;
width:220px;
height:180px;
background-color:orange;
margin-right:20px;
margin-bottom:10px;
}
li.every-forth{
background-color:orange;
width:208px !important;
margin-right:0;
}
.portfolio-div{
display:block;
margin-left:-40px;
}
</style>
</head>
<body>
<div class="container">
<div class="portfolio-div">
<ul>
<li class="portfolio">
<p>Column 1</p>
</li>
<li class="portfolio">
<p>Column 2</p>
</li>
<li class="portfolio">
<p>Column 3</p>
</li>
<li class="every-forth portfolio">
<p>Column 4</p>
</li>
</ul>
</div>
</div>
</body>
</html>