定义和用法
align-self 属性指定弹性容器内所选项目的对齐方式。
注意:align-self 属性将覆盖弹性容器的 align-items 属性。
实例
把弹性元素内的项目之一居中对齐:
#myBlueDiv {
align-self: center;
}
CSS 语法
align-self: auto|stretch|center|flex-start|flex-end|baseline|initial|inherit;
属性值
| 值 | 描述 |
|---|---|
| auto | 默认。元素继承其父容器的 align-items 属性,如果没有父容器,则为 "stretch"。 |
| stretch | 元素被拉伸以适应容器。 |
| center | 元素位于容器的中央。 |
| flex-start | 元素位于容器的开头。 |
| flex-end | 元素位于容器的末端。 |
| baseline | 元素被定位到容器的基线。 |
| initial | 将此属性设置为其默认值。参阅 initial。 |
| inherit | 从其父元素继承此属性。参阅 inherit。 |