1. You can use flex to layout one div in another div horizontally and vertically center
For example: html code:
<div class="container"> <div class="box"> </div> </div>
css code:
.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: This way you can center horizontally and vertically
2. The properties of flex
<div class="items"> <div class="item">1</div> <div class="item">23</div> <div class="item">4</div> </div>
There are six attributes that can be written on items:
•flex-direction
•flex-wrap
•flex-flow
•justify-content
•align-items
•align-content
There are 6 that can be written on the item:
•order//This is given to the item separately. If you want the item to change the order, give this attribute to the item.
•flex-grow
•flex-shrink
•flex-basis
•flex
•align-self
The above is all the content that the editor brings to you about the comprehensive understanding of the uses of flex. I hope everyone supports me~