本帖最后由 Samding 于 2019-11-23 22:35 编辑
图1是我的代码和效果,图2是想要的效果,差个垂直居中了(高宽不能写死,缩小浏览器的时候也要保持),问下要怎么弄?[XHTML] 纯文本查看 复制代码 <!DOCTYPE html>
[mw_shl_code=asm,false]<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
*{margin: 0;padding: 0;}
html,body{height: 100%;text-align: center;}
body{display: flex;flex-direction: column;}
.header{height: 100px;background: #524F5B;color: #fff;}
.main{background: #eee;flex: 1;display: flex;}
.left{width:100px;background: #00FFFF;}
.center{background: #C1C0C7;flex: 1;}
.right{width: 100px;background: #F05731;}
.footer{height: 100px;background: #524F5B;color: #fff;}
</style>
</head>
<body>
<div class="header">#header</div>
<div class="main">
<div class="left">#left</div>
<div class="center">#center</div>
<div class="right">#right</div>
</div>
<div class="footer">#footer</div>
</body>
|