flex 弹性盒子布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.container {
width: 100vw;
height: 100vh;
/* 设置弹性盒子 */
display: flex;
/*
row(默认): 主轴为水平方向,起点在左端
row-reverse: 主轴为水平方向,起点在右端
column: 主轴为垂直方向,起点在上沿
column-reverse: 主轴为垂直方向,起点在上沿
*/
flex-direction: column;
}
header {
height: 50px;
background: blueviolet;
}
section {
background: palegreen;
flex: 1;
}
footer {
height: 50px;
background: burlywood;
}
ul {
list-style: none;
display: flex;
/* 自动换行*/
flex-wrap: wrap;
/*
flex-flow:row wrap
direction和wrap的集合
*/
}
ul li{
width: 20vw;
height: 20vh;
background: red;
}
</style>
</head>
<body>
<div class="container">
<header>toubu</header>
<section>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</section>
<footer>dibu</footer>
</div>
</body>
</html>
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。