<div class="test1">
块级元素
</div>
<hr />
<div class="test2">
<span>
行内元素
</span>
</div>
<hr />
<div class="test3">
<div class="test4">
Flex
</div>
</div>
.test1 {
background: red;
height: 100px;
width: 100px;
margin: 0 auto;
}
.test2 {
background: yellow;
height: 100px;
width: 100%;
text-align: center;
}
.test3{
background:#f0f0f0;
height:200px;
width:100%;
position: relative;
}
.test4{
background:#a0a0a0;
height:100px;
width:100px;
position:absolute;
left:0px;
right:0px;
margin: 0 auto;
}