<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ padding: 0; margin:0; } html,body{ height: 100%; } .app{ background: #ccc; width: 100%; height: 100%; display: flex; flex-flow: column; margin: 0 auto; } header{ width: 100%; background: rgb(255,0,0); height: 60px; } main{ width: 100%; background: blue; flex: 1; display: flex; } aside{ width: 200px; background: cadetblue; } article{ flex:1; background: yellow; } footer{ width: 100%; background: rgb(0,255,0); height: 100px; } </style> </head> <body> <div class="app"> <header></header> <main> <aside></aside> <article></article> </main> <footer></footer> </div> </body> </html>
使用flex:1,可以填充空白部分