HTML:
首先,創(chuàng)建一個div容器,容器內(nèi)是需要居中的內(nèi)容
<div class="container">
<!--容器內(nèi)的元素將會居中-->

</div>
3行CSS代碼:
.container{
display: flex;
justify-content: center;
align-items: center;
}
HTML:
首先,創(chuàng)建一個div容器,容器內(nèi)是需要居中的內(nèi)容
<div class="container">
<!--容器內(nèi)的元素將會居中-->

</div>
3行CSS代碼:
.container{
display: flex;
justify-content: center;
align-items: center;
}