块元素在块元素之间不能使用text-align对齐
内联元素,行内块元素可以使用text-align对齐,对齐方式都写在父元素样式内
.div1{
width: 100px;
height: 100px;
background-color: red;
text-align: center;
}
.div1>div{
width: 50px;
height: 50px;
background-color: green;
text-align: center;
}
<div class="div1">
<div></div>
</div>