flex圣杯布局
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> * { margin: 0; padding: 0; } .demo { display: flex; flex-direction: column; } .divv { background-color: red; height: 50px; text-align: center; } .hetng { display: flex; height: 400px; border: 1px solid red; width: 100%; } .left, .center, .right { flex: 1; height: 400px; text-align: center; } .left { background-color: aqua; } .center { flex: 60%; background-color: blue; } .right { background-color: aqua; } </style> <body> <div class="demo"> <div class="divv tou">头部</div> <div class="hetng"> <div class="left">left</div> <div class="center">center</div> <div class="right">right</div> </div> <div class="divv di">底部</div> </div> </body> </html>
Document
头部
left
center
right
底部