多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## align-content属性 align-content 属性:在弹性容器内的各项没有占用交叉轴上所有可用的空间时对齐容器内的各项(垂直)。 **提示**:使用 justify-content 属性对齐主轴上的各项(水平)。 **注意**:容器内必须有多行的项目,该属性才能渲染出效果。 JavaScript 语法:object.style.alignContent="center" * * * ## CSS 语法 ~~~ align-content: stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit; ~~~ ## 默认值 | 值 | 描述 | 测试 | | --- | --- | --- | | stretch | 默认值。项目被拉伸以适应容器。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=stretch) | | center | 项目位于容器的中心。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=center) | | flex-start | 项目位于容器的开头。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=flex-start) | | flex-end | 项目位于容器的结尾。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=flex-end) | | space-between | 项目位于各行之间留有空白的容器内。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=space-between) | | space-around | 项目位于各行之前、之间、之后都留有空白的容器内。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=space-around) | | initial | 设置该属性为它的默认值。请参阅 [*initial*](https://www.w3cschool.cn/cssref/css-initial.html)。 | [测试 »](https://www.w3cschool.cn/tryrun/csstryit?tpl=playcss_align_content&param=initial) | | inherit | 从父元素继承该属性。请参阅 [*inherit*](https://www.w3cschool.cn/cssref/css-inherit.html)。 |   | ***** ## align-items 属性 align-items:设置了flex容器的对齐方式。 **提示**:使用每个flex对象元素的 align-self 属性可重写 align-items 属性。 JavaScript 语法:object.style.alignItems="center" ## CSS 语法 ``` align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit; ``` ## 属性值 | 值 | 描述 | 测试 | | --- | --- | --- | | stretch | 默认。 拉伸元件以适应容器。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#stretch) | | center | 中心元素在容器内。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#center) | | flex-start | 位置元素在容器的开头。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#flex-start) | | flex-end | 位置元素在容器的末端。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#flex-end) | | baseline | 位置元素在容器的基线。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#baseline) | | initial | 设置为默认值。请参阅[*initial*](https://www.w3cschool.cn/cssref/css-initial.html)。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit4.html#initial) | | inherit | 从其父元素继承此属性。请参阅[*inherit*](https://www.w3cschool.cn/cssref/css-inherit.html)。 |   | ***** ## align-self 属性 align-self 属性定义flex子项单独在侧轴(纵轴)方向上的对齐方式。。 **注意**:align-self 属性可重写灵活容器的 align-items 属性。 JavaScript 语法:object.style.alignSelf="center" * * * ## CSS 语法 ``` align-self: auto|stretch|center|flex-start|flex-end|baseline|initial|inherit; ``` ## **参数** | 值 | 描述 | 测试 | | --- | --- | --- | | auto | 默认值。元素继承了它的父容器的 align-items 属性。如果没有父容器则为 "stretch"。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#auto) | | stretch | 元素被拉伸以适应容器。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#stretch) | | center | 元素位于容器的中心。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#center) | | flex-start | 元素位于容器的开头。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#flex-start) | | flex-end | 元素位于容器的结尾。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#flex-end) | | baseline | 元素位于容器的基线上。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#baseline) | | initial | 设置该属性为它的默认值。请参阅[*initial*](https://www.w3cschool.cn/cssref/css-initial.html)。 | [测试 »](https://www.w3cschool.cn/statics/demosource/Playit/Playit5.html#initial) | | inherit | 从父元素继承该属性。请参阅[*inherit*](https://www.w3cschool.cn/cssref/css-inherit.html)。 |   |