CSS

地方自我 | place-self

place-self

place-self属性同时设置justify-self属性和align-self属性。第一个值是justify-self属性值,第二个是align-self属性值。如果第二个值不存在,第一个值也用于它。

句法

/* Keyword values */ place-self: auto center; place-self: normal start; /* Positional alignment */ place-self: center normal; place-self: start auto; place-self: end normal; place-self: self-start auto; place-self: self-end normal; place-self: flex-start auto; place-self: flex-end normal; place-self: left auto; place-self: right normal; /* Baseline alignment */ place-self: baseline normal; place-self: first baseline auto; place-self: last baseline normal; place-self: stretch auto; /* Global values */ place-self: inherit; place-self: initial; place-self: unset;

auto计算父级的align-items值。normal这个关键字的效果取决于我们所在的布局模式:

  • 在绝对定位的布局中,关键字的行为类似于start取代绝对定位的盒子stretch所有其他绝对定位的箱子。

  • 在绝对定位布局的静态位置中,关键字表现为stretch...

  • 对于Flex项,关键字表现为stretch...

  • 对于网格项,此关键字将导致类似于stretch,但具有高宽比或内部大小的盒子除外,在其中会表现为start.

  • 该属性不适用于块级别框和表格单元格。

self-start将对齐的项目与横轴上对应项目起点的对齐容器的边缘对齐。

first baseline

last baseline指定参与首次或最后一次基线对齐:将框的第一个或最后一个基准集的对齐基线与基准线共享组中所有框的共享第一个或最后一个基准线集中的相应基线对齐。

回退定位first baselinestart,一只为last baselineend

规格

SpecificationStatusComment
CSS Box Alignment ModuleThe definition of 'place-self' in that specification.Working DraftInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support59?45.0 (45.0)??No support

FeatureAndroid WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support5959?(Yes)?No support?