需求:多個div從下往上佈局 ,div垂直居中html
任何一個容器能夠指定爲flex佈局,可是td和th等標籤自己已有佈局,因此重寫display屬性會使元素失去原有的佈局特性佈局
*{flex
display:flexspa
}code
任何一個被設置爲彈性佈局的容器會有兩條抽象的軸,彈性佈局的容器的有如下屬性htm
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .container{ width:500px; height:500px; border: 1px solid #0e90d2; display: flex; flex-direction:row-reverse; } .box{ width:200px; height:200px; background:#bbbbbb; } </style> </head> <body> <div class="container"> <div class="box"> 1 </div> <div class="box"> 2 </div> <div class="box"> 3 </div> <div class="box"> 4 </div> <div class="box"> 5 </div> </div> </body> </html>