justify-content
justify-content属性用于设置弹性容器中子元素在主轴上的对齐方式。主轴是指弹性容器的方向,可以是水平方向(row)或垂直方向(column)。
justify-content:flex-start /*左对齐*/
justify-content:flex-end /*右对齐*/
justify-content:center /*居中*/
justify-content:space-between /*两端对齐,项目之间的间隔是相等的*/
justify-content:space-around /*每个项目两侧的间隔相等*/
justify-content:initial /*将此属性设置为属性的默认值*/
justify-content:inherit /*从父元素继承属性的值*/
justify-content:space-evenly; /*弹性间隔相等布局*/
使用示例
.anchen {
display: flex;
justify-content: center;
}
评论 (0)