鉴于以下
<style>
.container {
overflow: hidden;
height: 100%;
width: 90%;
margin: 15px auto 0px auto;
}
.square
{
float: left;
width: 80px;
height: 80px;
display: block;
background-image: url('commonimgs/empty_icon.png');
background-repeat: no-repeat;
margin: 2px;
padding-top: 3%;
margin-left: 5px;
}
</style>
<div>
<div class="container">
<div class="square">1R</div>
<div class="square">2R</div>
<div class="square">3R</div>
<div class="square">4R</div>
<div class="square">5R</div>
<div class="square">6</div>
<div class="square">7</div>
<div class="square">8</div>
<div class="square">9</div>
<div class="square">10</div>
</div>
</div>
我正在尝试制作一个自动居中并适应屏幕尺寸的平铺布局。我想不通的是如何squares
让container
.
得到...
+------------------------------------+
| |
| +------------------------------+ |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| +------------------------------+ |
| |
+------------------------------------+
想要
+------------------------------------+
| |
| +------------------------------+ |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| | +----+ +----+ +----+ | |
| | | | | | | | | |
| | | | | | | | | |
| | +----+ +----+ +----+ | |
| | | |
| +------------------------------+ |
| |
+------------------------------------+