指定弹性线与弹性容器的底部对齐,并将弹性项目水平对齐,使其之间具有相同的间距:
#container {
display: flex;
place-content: end space-between;
}
亲自试一试 »
下面有更多 "亲自试一试" 示例。
这个place-content
property 用于 Flexbox 和网格布局,是以下属性的简写属性:
如果 place-content 属性有两个值:
如果 place-content 属性只有一个值:
表中的数字指定完全支持该属性的第一个浏览器版本。
Property | |||||
---|---|---|---|---|---|
place-content | 59.0 | 79.0 | 53.0 | 11.0 | 46.0 |
place-content: normal|
value|initial|inherit;
Value | Description | Demo |
---|---|---|
normal | Default value. Dependant on layout context. The same as setting no property value for align-content and justify-content. | Demo ❯ |
stretch | Grid: Stretches grid items to fill the grid container if size is not set. Flexbox: Stretches flex items on the cross axis to fill the flex container if flex items have no specified size on the cross axis. |
Demo ❯ |
start | Align items at the start of the container | Demo ❯ |
end | Align items at the end of the container | Demo ❯ |
center | Align items to the center of the container | Demo ❯ |
space-between | Distribute available extra space evenly between the elements inside the container on both axis. | Demo ❯ |
space-around | Distribute available extra space evenly around each element inside the container on both axis. | Demo ❯ |
space-evenly | Distribute elements inside the container evenly on both axis. | Demo ❯ |
overflow-alignment |
|
|
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
块方向上的可用额外空间均匀分布在每个网格项周围,并且网格项在内联方向上对齐到中心:
#container {
display: grid;
place-content: space-around center;
}
亲自试一试 »
CSS教程:CSS 弹性盒
CSS教程:CSS 网格
CSS 参考:对齐内容属性
CSS 参考:调整内容属性
HTML DOM 参考:对齐内容属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!