justify-content
CSS justify-content
属性定义了浏览器如何分配顺着父容器主轴的弹性元素之间及其周围的空间。
- start
从行首开始排列。每行第一个元素与行首对齐,同时所有后续的元素与前一个对齐。 - flex-start
从行首开始排列。每行第一个弹性元素与行首对齐,同时所有后续的弹性元素与前一个对齐。 - flex-end
从行尾开始排列。每行最后一个弹性元素与行尾对齐,其他元素将与后一个对齐。 - center
伸缩元素向每行中点排列。每行第一个元素到行首的距离将与每行最后一个元素到行尾的距离相同。 - left
伸缩元素一个挨一个在对齐容器得左边缘,如果属性的轴与内联轴不平行,则left的行为类似于
align-items
CSS align-items属性将所有直接子节点上的align-self值设置为一个组。 align-self属性设置项目在其包含块中的对齐方式。
- normal
The effect of this keyword is dependent of the layout mode we are in:
- In absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes.
- In static position of absolutely-positioned layouts, the keyword behaves as stretch.
- For flex items, the keyword behaves as stretch.
- For grid items, this keyword leads to a behavior similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start.
- The property doesn't apply to block-level boxes, and to table cells.
- flex-start
元素向侧轴起点对齐。 - flex-end
元素向侧轴终点对齐。 - start
The item is packed flush to each other toward the start edge of the alignment container in the appropriate axis. - end
The item is packed flush to each other toward the end edge of the alignment container in the appropriate axis. - center
元素在侧轴居中。如果元素在侧轴上的高度高于其容器,那么在两个方向上溢出距离相同。 - left
The items are packed flush to each other toward the left edge of the alignment container. If the property’s axis is not parallel with the inline axis, this value behaves like start. - right
The items are packed flush to each other toward the right edge of the alignment container in the appropriate axis. If the property’s axis is not parallel with the inline axis, this value behaves like + start. - self-start
The items is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis. - self-end
The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis. - baseline
- first baseline
- last baseline
所有元素向基线对齐。侧轴起点到元素基线距离最大的元素将会于侧轴起点对齐以确定基线。 - stretch
弹性元素被在侧轴方向被拉伸到与容器相同的高度或宽度。 - safe
If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start. - unsafe
Regardless of the relative sizes of the item and alignment container, the given alignment value is honored.
align-content
align-content
属性定义了当作为一个弹性盒子容器的属性时,浏览器如何在容器的侧轴围绕弹性盒子项目分配空间。
该属性对单行弹性盒子模型无效。
- flex-start
所有行从垂直轴起点开始填充。第一行的垂直轴起点边和容器的垂直轴起点边对齐。接下来的每一行紧跟前一行。 - flex-end
所有行从垂直轴末尾开始填充。最后一行的垂直轴终点和容器的垂直轴终点对齐。同时所有后续行与前一个对齐。 - center
所有行朝向容器的中心填充。每行互相紧挨,相对于容器居中对齐。容器的垂直轴起点边和第一行的距离相等于容器的垂直轴终点边和最后一行的距离。
网友评论