大网数据广告活动
Web 标准与前端开发

Box alignment in multi-column layout

· 52CE 我爱测

The CSS box alignment module details how alignment works in various layout methods; in this guide, we explore how box alignment works in the context of multi-column layout. As this guide aims to detail things that are specific to both modules, it should be read in conjunction wit

The CSS box alignment module details how alignment works in various layout methods; in this guide, we explore how box alignment works in the context of multi-column layout. As this guide aims to detail things that are specific to both modules, it should be read in conjunction with the box alignment overview guide, which details the common features of box alignment across layout methods.

In multi-column layout, the alignment container is the content box of the multicol container. The alignment subject is the column box. The properties which apply to multi-column layouts are detailed below.

align-content and justify-content

The align-content property applies to the block axis and justify-content to the inline axis. Any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the column-gap (or gap shorthand) property.

Using a value of justify-content other than normal or stretch will cause column boxes to display at the column-width specified on the multicol container, and the remaining space distributed according to the value of justify-content.

column-gap

The column-gap property was originally specified in the multiple-column layout specification and then later unified with the gap properties for other layout methods in box alignment. While other layout methods treat the initial value of column-gap as 0, multi-column layout treats it as 1em — you generally want a gap between columns.

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。