一、可以利用flex來(lái)布局一個(gè)p在另一個(gè)p里面水平垂直居中
如:html代碼:
<p class="container"> <p class="box"> </p> </p>
css代碼:
.container{ width:600px; height:400px; border:1px solid blue; display: flex; justify-content:center; align-items:center; } .box{ width:200px; height:100px; border:1px red solid;
ps:這樣就可以水平垂直居中咯
二、flex的屬性
<p class="items"> <p class="item">1</p> <p class="item">23</p> <p class="item">4</p> </p>
可以寫在items上的屬性有六個(gè):
?flex-direction
?flex-wrap
?flex-flow
?justify-content
?align-items
?align-content
可以寫在item上的有6個(gè):
?order//這個(gè)就是item單獨(dú)給了,要是想讓那個(gè)item調(diào)換順序就給這個(gè)屬性給那個(gè)item
?flex-grow
?flex-shrink
?flex-basis
?flex
?align-self