比方说,我有与以下规格的容器:如何创建3个相同大小的盒子?
.container {
width: 960px;
margin: 0 auto;
height: 500px;
}
现在,在中间我想补充的3盒彼此相邻排列,平行以下规格:
.box1 {
background-color: #000;
width: 300px;
height: 200px;
}
.box2 {
background-color: #999;
width: 300px;
height: 200px;
}
.box3 {
background-color: #333;
width: 300px;
height: 200px;
}
我试着用margin-top和margin-left在每个上面,但是这很麻烦,而且让它们看起来与它们之间有足够的沟槽看起来一样麻烦。什么是创建这个最好的方法?
广告向每个盒子元素提供“浮动:向左”,然后使用边距使它们间隔相等。 – 2013-04-10 00:56:37