0
我在一个容器中并排放置了四行三个div。整个事情应该是敏感的,所以它可以自动调整到可变容器宽度,即桌面三格,平板电脑旁边的两个div和智能手机,单独一个div。 我认为当为每个div设置30%的宽度时,剩余的10%将按照边距在两个div之间分割,即每个div之间5%的边距。但是现在我得到了我的第三个分区权利的全部10%的保证金,这意味着所有的div都粘在一起了。如何在div之间获得2 x 5%的保证金(保证金 - 右侧:5%不起作用)?三个并列的div,但它们之间没有自动保证金
.aaa {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:blue;
}
.bbb {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:grey;
}
.ccc {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:green
}
.ddd {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:yellow
}
.eee {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:red
}
.fff {
position: relative;
display: block;
text-align: left;
\t margin-top:30px;
\t padding:2px 25px 2px 25px;
\t text-align:center;
\t float:left;
\t width:30%;
\t height:239px;
background-color:black
}
<div class="container">
<div class="aaa"><a href="#"><h1>aaa</h1></a></div>
<div class="bbb"><a href="#"><h1>bbb</h1></a></div>
<div class="ccc"><a href="#"><h1>ccc</h1></a></div>
<div class="ddd"><a href="#"><h1>ddd</h1></a></div>
<div class="eee"><a href="#"><h1>eee</h1></a></div>
<div class="fff"><a href="#"><h1>fff</h1></a></div>
</div>