1 Star 0 Fork 0

math.most/html-css

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
014flex-flow.html 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
math.most 提交于 2021-09-27 19:40 +08:00 . first commit
<!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>flex-flow</title>
<style>
* {
margin: 0;
padding: 0;
}
.content {
width: 900px;
height: 500px;
background-color: #ccc;
margin: 0 auto;
/* 设置父容器为伸缩布局, 子元素会自动变成伸缩项 */
display: flex;
/* 设置子元素的排列方式
flex-start 让子元素从父容器的·起始·位置开始排列
flex-end 让子元素从父容器的·结束·位置开始排列
center 让子元素从父容器的·中间·位置开始排列
space-between 左右对齐父元素的开始和结束位置,中间平均分页产生相同的间距
space-around 将多余的空间平均的分页在每一个元素的两边
*/
justify-content: center;
/* flex-flow: 是flex-wrap和flex-direction的综合
flex-wrap: 控制子元素是否换行显示,默认不换行
nowrap 不换行,则收缩
wrap 换行
wrap-reverse 翻转,原来是从上到下,翻转后就是从下到上排列
*/
flex-wrap: wrap;
/* flex-direction: 设置子元素的排列方式,就是用来设置主轴的排列方式,默认为row
row 水平排列,从左到右
cloumn 垂直排列方向 从上到下
row-reverse
column-reverse
*/
flex-direction: column
}
.first {
width: 200px;
height: 200px;
background-color: red;
}
.second {
width: 200px;
height: 200px;
background-color: green;
}
.third {
width: 200px;
height: 200px;
background-color: purple;
}
.fourth {
width: 200px;
height: 200px;
background-color: blue;
}
.fifth {
width: 200px;
height: 200px;
background-color: pink;
}
</style>
</head>
<body>
<div class="content">
<div class="first">1</div>
<div class="second">2</div>
<div class="third">3</div>
<div class="fourth">4</div>
<div class="fifth">5</div>
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mathmost/html-css.git
git@gitee.com:mathmost/html-css.git
mathmost
html-css
html-css
master

搜索帮助