代码
提交代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>demo</title> <style> html,body{ padding:0; margin:0; height: 100%; color:#fff; } .demo{ height: 100%; display: flex; flex-direction: column; } .head,.foot{ flex:0 1 100px; background: #000; } .content{ flex: 1; background: red; } </style> </head> <body> <div class="demo"> <div class="head">头部</div> <div class="content">内容</div> <div class="foot">尾部</div> </div> </body> </html>
运行结果