- HTML中文网
- 联系QQ:88526
- QQ交流群

- 微信公众号

CSS justify-content属性
定义和用法
justify-content 用于设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式。
提示:使用 align-content 属性对齐交叉轴上的各项(垂直)。
默认值: | flex-start |
继承: | 否 |
可动画化: | 否 |
版本: | CSS3 |
JavaScript 语法: | object.style.justifyContent="space-between" |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器的版本号。
紧跟在 -webkit-, -ms- 或 -moz- 后的数字为支持该前缀属性的第一个版本。
属性 | ![]() | ![]() | ![]() | ![]() | ![]() |
justify-content | 29.0 21.0 -webkit- | 11.0 | 28.0 18.0 -moz- | 9.0 6.1 -webkit- | 17.0 |
语法
justify-content: flex-start|flex-end|center|space-between|space-around|initial|inherit;
属性值
值 | 描述 |
flex-start | 默认值。项目位于容器的开头。 |
flex-end | 项目位于容器的结尾。 |
center | 项目位于容器的中心。 |
space-between | 项目位于各行之间留有空白的容器内。 |
space-around | 项目位于各行之前、之间、之后都留有空白的容器内。 |
initial | 设置该属性为它的默认值。请参阅 initial。 |
inherit | 从父元素继承该属性。请参阅 inherit。 |
在弹性盒对象的 <div> 元素中的各项周围留有空白:
推荐手册