css,justify-content属性
web前端-css教程
css justify-content 用于设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式,对齐方式有:位于容器的开头、位于容器的结尾、位于容器的中心、均匀分布等等。android项目源码下载,ubuntu安装推特,tomcat 并发量计算,爬虫会话失效,泉州php培训学校,嘉善营销号seo推广大概是什么lzw
dz论坛彩票开奖源码,ubuntu怎么提高权限,python爬虫过去大数,php樱花飘落,绍兴seo工具lzw
css justify-content属性怎么用?php企业项目源码下载,ipad 怎么用vscode,ubuntu安装卡里,tomcat 热加载设置,sqlite 执行时间差,py爬虫抖音停留验证码中间页,php mysql 报错,seo网页设置最佳频率,网站在线咨询模块,淘宝邮件模板lzw
justify-content 用于设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式。可以使用 align-content 属性对齐交叉轴上的各项(垂直)。语法:
justify-content: flex-start|flex-end|center|space-between|space-around|initial|inherit;
属性值:
● flex-start:默认值。项目位于容器的开头。
● flex-end:项目位于容器的结尾。
● center:项目位于容器的中心。
● space-between:项目位于各行之间留有空白的容器内,即均匀分布在线上; 第一项是在起始行,最后一项是在结束行。
● space-around:项目位于各行之前、之间、之后都留有空白的容器内。
● initial:设置该属性为它的默认值。
● inherit:从父元素继承该属性。
css justify-content属性 示例
.flex-container { padding: 0; margin: 0; list-style: none; display: flex;}.flex-start { justify-content: flex-start; }.flex-end { justify-content: flex-end; } .flex-end li { background: gold;}.center { justify-content: center; } .center li { background: deepskyblue;}.space-between { justify-content: space-between; } .space-between li { background: lightgreen;}.space-around { justify-content: space-around; }.space-around li { background: hotpink; }.space-evenly { justify-content: space-evenly; }.space-evenly li { background: #bada55; }.flex-item { background: tomato; padding: 5px; width: 60px; height: 50px; margin: 5px; line-height: 50px; color: white; font-weight: bold; font-size: 2em; text-align: center;}
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
效果图:
说明:
红色列表是justify-content属性设置为 flex-start
黄色是justify-content属性设置为 flex-end
蓝色是justify-content属性设置为 center
绿色是justify-content属性设置为 space-between
粉红色是justify-content属性设置为 space-around
浅绿色是justify-content属性设置为 space-evenly