【发布时间】:2017-05-01 03:21:09
【问题描述】:
孩子水平居中,但不是垂直居中。我认为这是因为示例容器需要设置高度。如果我希望它集中在整个页面上怎么办?
请看下面的代码-sn-p
.example-container {
display: flex;
align-items: center;
justify-content: center;
}
.example-child {
width: 100px;
height: 100px;
background-color: orange;
}
<div class="example-container">
<div class="example-child">
<p>Sample Content...</p>
</div>
</div>
【问题讨论】: