CSS 间隙装饰模块 1 级

W3C 编辑草案,

关于本文档的更多细节
本版本:
https://www.w3.org/TR/2026/WD-css-gaps-1-20260227/
最新发布版本:
https://www.w3.org/TR/css-gaps-1/
编辑草稿:
https://drafts.csswg.org/css-gaps-1/
以往版本:
历史记录:
https://www.w3.org/standards/history/css-gaps-1/
反馈:
CSSWG 问题库
编辑:
Kevin Babbitt (微软)
建议修订本规范:
GitHub 编辑器
测试套件:
https://wpt.fyi/results/css/css-gaps/

摘要

本模块引入了多个属性,用于为如 grid 和 flex 等容器布局类型添加行与列的间隙装饰。

CSS 是一种用于描述结构化文档(如 HTML 和 XML) 在屏幕、纸张等介质上的呈现方式的语言。

本文档状态

本节描述了本文档在发布时的状态。 当前 W3C 出版物列表 以及本技术报告的最新修订版 可在 W3C 标准与草案索引 中找到。

本文档由CSS 工作组 采用推荐路径 作为工作草案发布。 以工作草案形式发布 并不表示 W3C及其成员的认可。

本文件为草案文档, 可能随时被更新、替换 或被其他文档废止。 除作为在研项目外,不宜引用本文件。

请通过在 GitHub 上提交 issue(推荐) 发送反馈,标题请包含规范代码“css-gaps”,格式如下: “[css-gaps] …评论摘要…”。 所有问题和评论会被归档。 或者,可以通过(归档)公开邮件列表 www-style@w3.org 反馈。

本文档受 2025 年 8 月 18 日 W3C 流程文件 管理。

本文档由依据 W3C 专利政策运行的小组制作。 W3C 维护 相关专利披露公开列表 (与本组交付物相关); 该页面也包含专利披露说明。 任何知悉专利且认为其包含 必要权利要求 的个人,须按照 W3C 专利政策第 6 节 披露信息。

1. 引言

本节非规范性内容。

CSS Multicol 1 § 4 列间隙与分隔线 允许在 多列容器 的列之间绘制分隔线。 本规范扩展了 column-rule-widthcolumn-rule-stylecolumn-rule-color 属性,增加了行方向的等价属性,扩展到其他容器布局,并提供高级控制以决定间隙装饰的绘制方式和位置。

1.1. 值的定义

本规范遵循 CSS 属性定义约定(见 [CSS2]), 并使用 值定义语法(见 [CSS-VALUES-3])。 未在本规范中定义的值类型详见 CSS Values & Units [CSS-VALUES-3]。 与其他 CSS 模块的结合可能扩展这些值类型的定义。

除了各自定义处列出的属性特定值外, 本规范定义的所有属性 还接受 CSS 全局关键字 作为属性值。 为了可读性未在此处重复列出。

2. 间隙

CSS 中的多种布局,如 多列容器弹性盒容器网格容器网格行列容器 会将子元素框彼此并排放置,其间会有 间隙(gap),也称为gutter(槽)。

在本规范中, 间隙(gap)列间隙(column gap)行间隙(row gap) 依容器类型定义如下:

多列容器
在列方向上, 间隙列间隙)指每个多列行内相邻列盒之间的,见 [CSS-MULTICOL-1]。 在行方向上,间隙行间隙)指由column-height建立的列盒行之间的 ,见 [CSS-MULTICOL-2]
弹性盒容器
主轴方向 (如row方向弹性盒 column-gap), 间隙列间隙)指单个弹性盒行内项目之间的

交叉轴 (如row方向弹性盒的 row-gap), 间隙行间隙)指相邻 弹性盒行之间的

网格容器
行间隙列间隙 分别指网格行网格列之间。 详细见CSS Grid Layout 1 § 10.1 槽:row-gap、column-gap 和 gap 属性

注:CSS Box Alignment 3 § 8.1 行与列槽:row-gap 与 column-gap 属性所述, 由justify-contentalign-content 添加的额外空间也计入间隙大小。

多列容器内的列间隙(橙色),带跨列元素。 注意 列间隙 在遇到跨列元素时会断开。
多列容器(`column-wrap: wrap`),列间隙为橙色,行间隙为蓝色。 注意多列容器中的 列间隙 不会与 行间隙 重叠,类似 flex。
网格容器中的间隙,列间隙为橙色,行间隙为蓝色。 注意间隙重叠的阴影区域。
弹性盒容器中的间隙,列间隙为橙色,行间隙为蓝色。 注意,不同于 grid,flex 的间隙不会重叠。

3. 间隙装饰

间隙可以包含间隙装饰, 即在相邻盒之间绘制的可见分隔符(如线)

间隙装饰不占用空间。 也就是说,间隙装饰的存在或宽度不会影响其它内容的位置。 如果间隙装饰宽于其所处间隙,相邻盒会覆盖此装饰, 某些情况下装饰甚至可能超出容器边界。

间隙装饰绘制在容器边框正上方。 对可滚动容器而言, 注意容器的边框和背景不会随内容滚动, 但装饰需要与容器内项目一同滚动。

3.1. 几何

间隙装饰间隙内以一个或多个间隙装饰线段的形式绘制。

3.1.1. 线段端点

线段端点间隙中线上的点,间隙装饰线段 可以从该点开始或结束。端点类型有两种:

要为某个间隙 G 创建线段端点
  1. 间隙的两端:

    G 的两个边界创建端点:

    当间隙延伸到内容边界时,这些端点与对应内容边重合。

  2. 间隙内部:

    间隙连接区G 内有一个或多个间隙G 相邻或重叠的区域。 对每个间隙连接区,应创建两个线段端点

    此顺序(终止线段端点、起始线段端点)反映了间隙连接区对应着 一个轨道/项目/列的末尾与另一个的开始。

下例展示了线段端点的位置, 其中紫色 + 表示 起始线段端点, 绿色 + 表示 终止线段端点间隙连接区以虚线框显示。
.grid-with-spans {
  display: grid;
  grid-template: repeat(4, 100px) / repeat(4, 100px);
  gap: 20px;
  background: rgb(255 255 128);
}
.grid > * {
  border: 1px dashed black;
}
带有跨行项目的网格中的线段端点间隙连接区位置。 线段端点创建于每个间隙的边界(即容器边缘), 在行与列间隙重叠之处于间隙内部以“终止-起始”方式生成端点。
.flex {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: 500px;
  background: rgb(255 255 128);
}
.flex > * {
  border: 1px dashed black;
}
弹性盒容器中的线段端点间隙连接区位置。 列间隙在其边界处创建端点;有些边界与容器边缘重合(如#1与#2、#2与#3间隙的起始点,与容器顶边重合;#7与#8间隙的终点,与容器底边重合)。 行间隙(行之间)在其边界处创建端点,也与容器左右边重合。 列间隙与行间隙相遇处,以“终止-起始”方式创建两个端点。
.multi-column {
  column-count: 3;
  column-width: 100px;
  column-height: 50px;
  column-wrap: wrap;
  gap: 20px;
  background: rgb(255 255 128);
}

.multi-column > * {
  height: 100px;
  border: 1px dashed black;
}	
多列容器中线段端点间隙连接区的位置。 列间隙(列盒间)在边界处创建端点,有些边界与容器边重合(如前两个列间隙的起始点与顶边重合,最后两个列间隙的终点与底边重合)。 行间隙(列盒行之间)在边界处创建端点,与容器左右边重合。 列间隙与行间隙相邻处,以“终止-起始”方式生成两个端点。

3.1.2. 间隙装饰线段

定义

A gap decoration segment 是通过将一个 start segment endpoint 与一个 end segment endpoint 配对而形成的。 每个 gap 形成一组 gap decoration segments

在本节中,我们将一个 gap decoration segment s 表示为 s = [s.start, s.end], 其中 s.start 是该线段的 start segment endpoint, 而 s.end 是该线段的 end segment endpoint

UNION(s1, s2) 等于 [s1.start, s2.end]。

如果对于其端点之间的每个 gap junction, 在间隙两侧存在跨越该连接区所涉及的所有垂直 gaps 的项目, 则一个 gap decoration segment 被称为 被跨跨项目环绕(flanked by spanning items)。

在给定的 gap 的上下文中,一对 segment endpoints ab 被视为 不连续的(discontiguous),如果从 ab 的线段(宽度与该 gap 相同)与容器内的某个子项相交。

算法
要为给定的 gap G 确定间隙装饰线段
  1. S 为空列表。
  2. endpoints 为对 G 调用 创建线段端点 的结果, 并按它们沿 G 中线从起点到终点的位置排序。

    注: 该列表保证包含偶数个元素,并严格交替出现 start segment endpointend segment endpoint, 且以一个 start segment endpoint 开始。

  3. 如果 endpoints 为空,返回 S
  4. break 为适用于该间隙的 column-rule-breakrow-rule-break 的已使用值(以适用者为准)。
  5. 如果 breaknone
    1. firstendpoints 中的第一个项目。
    2. lastendpoints 中的最后一个项目。
    3. 创建一个 gap decoration segment segment = [first, last]。
    4. segment 应用偏移,然后将其追加到 S
    5. 返回 S
  6. 空检查: 如果 endpoints 为空,返回 S
  7. endpoints 的前两个项目创建一个 gap decoration segment s。并从列表中移除这两项。
  8. 如果 s 的端点为 不连续的,则回到 空检查
  9. endpoints 非空时:
    1. endpoints 的前两个项目创建一个 gap decoration segment next,但保留它们在列表中。
    2. candidateUNION(s, next)。
    3. 如果 candidate 的端点为 不连续的,退出此循环。
    4. 如果 breakintersection 并且 candidate 不是 被跨跨项目环绕,则退出此循环。
    5. endpoints 中移除前两个项目。
    6. s 设为 UNION(s, next)。
  10. s 应用偏移,然后将其追加到 S
  11. 回到 空检查
要对线段 s = [start, end] 应用偏移
  1. start 按适用的 rule-inset 属性的已使用值偏移。
  2. end 按适用的 rule-inset 属性的已使用值偏移。
  3. 用调整后的 [start, end] 更新 s
网格容器中 间隙装饰线段(蓝色和红色矩形)的示意图。 线段在成对的 线段端点 之间绘制, start segment endpoint 用紫色十字标记, end segment endpoint 用绿色十字标记。
弹性容器中 间隙装饰线段(蓝色和红色矩形)的示意图。 线段在成对的 线段端点 之间绘制, start segment endpoint 用紫色十字标记, end segment endpoint 用绿色十字标记。
多列容器(column-wrap: wrap)中 间隙装饰线段(蓝色和红色矩形)的示意图。 线段在成对的 线段端点 之间绘制, start segment endpoint 用紫色十字标记, end segment endpoint 用绿色十字标记。
弹性容器中 间隙装饰线段(蓝色和红色矩形)的示意图。 线段在成对的 线段端点 之间绘制, start segment endpoint 用紫色十字标记, end segment endpoint 用绿色十字标记。
弹性容器中 间隙装饰线段(蓝色和红色矩形)的示意图。 线段在成对的 线段端点 之间绘制, start segment endpoint 用紫色十字标记, end segment endpoint 用绿色十字标记。
测试

3.2. 交叉处断开行为:column-rule-breakrow-rule-breakrule-break 属性

名称: column-rule-break, row-rule-break
值: none | normal | intersection
初始值: normal
适用于: grid 容器, flex 容器, 多列容器, 以及 grid lanes 容器
可继承: no
百分比: n/a
计算值: 按指定
规范顺序: 与语法一致
动画类型: 离散值

这些属性设置某个间隙内装饰在容器内项目形成的可见“T”形或“十字”交叉点处分割为线段的行为。 如何应用这些值的具体细节,见确定间隙装饰线段的步骤。

none
间隙装饰不会在可见的“T”形或“十字”交叉点处开始或结束。 而是从间隙一端到另一端绘制一个连续的装饰线。
normal
行为依赖于容器类型。
Grid 容器
间隙装饰会在可见的“T”交叉处开始和结束, 但会穿越可见的“十字”交叉点。
Flex 容器
行为与 none 相同。
多列容器
column-rule-break,行为如 intersection。 对 row-rule-break,行为如 none
intersection
间隙装饰会在可见的“T”形和“十字”交叉点处开始和结束。
测试
名称: rule-break
值: <'column-rule-break'>
初始值: 见各自属性
适用于: column-rule-breakrow-rule-break 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法一致

简写属性会把 column-rule-breakrow-rule-break 同时设置为相同的值。

测试

下面的示例说明了 *-rule-break 属性的各种设置。

.break-normal-grid {
  display: grid;
  grid-template: repeat(4, 100px) / repeat(4, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-break: normal;
}
网格中 间隙装饰的默认断开行为。 每条装饰遇到横跨该间隙的项目时会中断。
.break-none-grid {
  display: grid;
  grid-template: repeat(4, 100px) / repeat(4, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-break: none;
}
网格 间隙装饰无断开。 注意间隙装饰会延伸到被放置在 grid 中的项目“背后”。
.break-intersection-grid {
  display: grid;
  grid-template: repeat(4, 100px) / repeat(4, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-break: intersection;
}
网格 间隙装饰 局限于未被对侧跨项目 环绕的每个 间隙装饰线段 内绘制。
.break-normal-multicol {
  column-width: 150px;
  column-height: 300px;
  gap: 1em;
  row-rule: 4px solid red;
  column-rule: 4px solid blue;
  rule-break: normal;
}
多列下 间隙装饰 设置 rule-break 为 normal 的效果。 注意列方向表现如 rule-break 设置为 intersection, 行方向表现如 rule-break 设置为 none
.break-intersection-multicol {
  column-width: 150px;
  column-height: 300px;
  gap: 1em;
  row-rule: 4px solid red;
  column-rule: 4px solid blue;
  rule-break: intersection;
}
多列下 间隙装饰 设置 rule-break 为 intersection 的效果。
.break-normal-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-break: normal;
}
Flex 容器中 间隙装饰的默认断开行为。
注意每一条 flex 行有自己独立的间隙: 这有两个影响:
  1. 相邻 flex 行里的 间隙装饰 互不影响,即使它们的间隙对齐。
  2. nonenormal 显示效果相同。
.break-intersection-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: 500px;
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-break: intersection;
}
Flexbox 间隙装饰 被局限在每个 间隙装饰线段 内。

3.3. 调整间隙装饰端点:rule-inset 属性

名称: column-rule-edge-inset-start, column-rule-edge-inset-end, column-rule-interior-inset-start, column-rule-interior-inset-end, row-rule-edge-inset-start, row-rule-edge-inset-end, row-rule-interior-inset-start, row-rule-interior-inset-end
值: <length-percentage>
初始值: 0
适用于: grid 容器, flex 容器, 多列容器, 以及 grid lanes 容器
可继承: no
百分比: 参考 交叉间隙宽度
计算值: 按指定值
规范顺序: 与语法顺序一致
动画类型: 按计算值类型

这些属性可以用于相对于通常决定装饰开始和结束位置的线段端点,偏移间隙装饰的起始和结束点。

边缘线段端点是指创建于容器内容边缘的线段端点

内部线段端点是指创建于间隙连接区线段端点

百分比值相对于交叉间隙宽度进行计算,定义如下:

边缘线段端点
交叉间隙宽度0
内部线段端点
交叉间隙宽度间隙连接区间隙所在同一维度下的尺寸 (行间隙则为水平方向、列间隙则为垂直方向)。

注: 通常为交叉或毗邻间隙上适用的 column-gaprow-gap 属性的已用值 。外加因justify-contentalign-content 添加的额外间距。 但若间隙在重叠区间相交或毗邻时, 交叉间隙宽度由这些区间的并集决定。 见本例

column-rule-edge-inset-startrow-rule-edge-inset-start 属性适用于作为边缘线段端点start segment endpointscolumn-rule-interior-inset-startrow-rule-interior-inset-start 属性适用于作为内部线段端点start segment endpoints。 对于这些属性,正值沿间隙轴方向向前偏移,负值向后偏移。

column-rule-edge-inset-endrow-rule-edge-inset-end 属性适用于作为边缘线段端点end segment endpointscolumn-rule-interior-inset-endrow-rule-interior-inset-end 属性适用于作为 内部线段端点end segment endpoints。 对于这些属性,正值沿间隙轴反方向偏移,负值则向前偏移。

测试

3.3.1. -start-end 简写

这些简写可以使作者实现统一的不对称装饰。

.inset-start-8px-end-0px {
  column-rule-inset-start: 8px;
  column-rule-inset-end: 0px;
}
起始端内缩 8px 会让间隙装饰的头部内收, 终止端内缩 0px 则让 间隙装饰结尾对齐内容边缘。
名称: column-rule-inset-start, column-rule-inset-end, row-rule-inset-start, row-rule-inset-end
值: <length-percentage>
初始值: 见各自属性
适用于: column-rule-edge-inset-startcolumn-rule-interior-inset-startcolumn-rule-edge-inset-endcolumn-rule-interior-inset-endrow-rule-edge-inset-startrow-rule-interior-inset-startrow-rule-edge-inset-endrow-rule-interior-inset-end 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

这些简写属性会将相应的 -edge--interior- 属性都设置成相同的值。 例如,column-rule-inset-start 同时设置 column-rule-edge-inset-startcolumn-rule-interior-inset-start 为相同值。

名称: rule-inset-start
值: <'column-rule-inset-start'>
初始值: 见各自属性
适用于: column-rule-inset-startrow-rule-inset-start 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

简写属性会同时设置 column-rule-inset-startrow-rule-inset-start 为相同值。

名称: rule-inset-end
值: <'column-rule-inset-end'>
初始值: 见各自属性
适用于: column-rule-inset-endrow-rule-inset-end 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

简写属性会同时设置 column-rule-inset-endrow-rule-inset-end 为相同值。

3.3.2. -edge--interior- 简写

这些简写允许作者在边缘与内部交叉处实现不同的处理效果。

.inset-edge-0px-interior-negative-5px {
  column-rule-edge-inset: 0px;
  column-rule-interior-inset: -5px;
  column-rule-break: intersection;
}
内部内缩 -5px 会使内部间隙装饰的端点略微超出相邻项目边缘。 边缘内缩 0px 则让边缘 间隙装饰的端点对齐内容边缘。
名称: column-rule-edge-inset, column-rule-interior-inset, row-rule-edge-inset, row-rule-interior-inset
值: <length-percentage> [ <length-percentage> ]?
初始值: 见各自属性
适用于: column-rule-edge-inset-startcolumn-rule-edge-inset-endcolumn-rule-interior-inset-startcolumn-rule-interior-inset-endrow-rule-edge-inset-startrow-rule-edge-inset-endrow-rule-interior-inset-startrow-rule-interior-inset-end 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

这些简写会分别设置相应的 -start-end 属性。 例如,column-rule-edge-inset 会同时设置 column-rule-edge-inset-startcolumn-rule-edge-inset-end。 如果只给出一个值,两个属性都设为该值。 如果给出两个值,-start 使用第一个,-end 使用第二个。

名称: rule-edge-inset
值: <'column-rule-edge-inset'>
初始值: 见各自属性
适用于: column-rule-edge-insetrow-rule-edge-inset 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

简写属性会同时设置 column-rule-edge-insetrow-rule-edge-inset为相同值。

名称: rule-interior-inset
值: <'column-rule-interior-inset'>
初始值: 见各自属性
适用于: column-rule-interior-insetrow-rule-interior-inset 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

简写属性会同时设置 column-rule-interior-insetrow-rule-interior-inset为相同值。

测试

3.3.3. 通用简写

这些简写允许作者在整个容器内实现统一的处理效果。

.inset-0px {
  column-rule-inset: 0px;
  column-rule-break: intersection;
}
内缩 0px 会使 间隙装饰的末端对齐到相邻项目边缘。
.inset-positive-5px {
  column-rule-inset: 5px;
  column-rule-break: intersection;
}
内缩 5px 会使 间隙装饰的末端相对项目边缘收短。
.inset-negative-5px {
  column-rule-inset: -5px;
  column-rule-break: intersection;
}
内缩 -5px 会使 间隙装饰的末端略微超越相邻项目边缘。
.inset-negative-50percent {
  column-rule-inset: -50%;
  column-rule-break: intersection;
}
内缩 -50% 会让 间隙装饰的每一端延伸到交叉点的一半位置。 相邻 间隙装饰“中途相遇”以形成连续的线。 注意在容器边缘处,交叉间隙宽度被定义为0, 所以 -50% 的内缩值解析后也是 0, 因此 间隙装饰不会超出容器范围。 (与前面示例里的 px 单位内缩形成对比。)
名称: column-rule-inset, row-rule-inset
值: <'column-rule-edge-inset'> [ / <'column-rule-interior-inset'> ]?
初始值: 见各自属性
适用于: column-rule-edge-insetcolumn-rule-interior-insetrow-rule-edge-inset 以及 row-rule-interior-inset 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

这些简写设置了对应的边缘和内部的起止值。 值的顺序如下:

edge-start edge-end? [/ interior-start interior-end?]?

省略的值按如下方式补齐:

  1. 如果内部值省略,则从边缘值复制。
  2. 任何省略的 end 值由对应 start 值补齐。
名称: rule-inset
值: <'column-rule-inset'>
初始值: 见各自属性
适用于: column-rule-insetrow-rule-inset 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法顺序一致

简写属性会同时设置 column-rule-insetrow-rule-inset为相同值。

测试

3.4. 间隙装饰可见性:rule-visibility-items 属性

名称: column-rule-visibility-items, row-rule-visibility-items
值: all | around | between
初始值: all
适用于: grid 容器,以及 多列容器
可继承: no
百分比: n/a
计算值: 按指定值
规范顺序: 与语法一致
动画类型: 离散

这些属性决定间隙装饰线段是否绘制在与空区域相邻的间隙部分。

all
无论相邻区域是否有项目,所有间隙线段都绘制装饰。
around
只要相邻的两个区域有一个被项目占据,则该间隙线段绘制装饰。
between
仅当两个相邻区域都被项目占据时,才在该间隙线段绘制装饰。
名称: rule-visibility-items
值: <'column-rule-visibility-items'>
初始值: 见各自属性
适用于: column-rule-visibility-itemsrow-rule-visibility-items 相同
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法一致

简写属性同时设置 column-rule-visibility-itemsrow-rule-visibility-items 为相同值。

.break-normal-with-all-grid {
  display: grid;
  grid-template: repeat(3, 100px) / repeat(3, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-visibility-items: all;
}
Grid 中采用 normal 断开和 all 可见性(默认值)的间隙装饰。
.break-normal-with-around-grid {
  display: grid;
  grid-template: repeat(3, 100px) / repeat(3, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-visibility-items: around;
}
Grid 中采用 normal 断开和 around 可见性的间隙装饰。
.break-normal-with-between-grid {
  display: grid;
  grid-template: repeat(3, 100px) / repeat(3, 100px);
  gap: 20px;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
  rule-visibility-items: between;
}
Grid 中采用 normal 断开和 between 可见性的间隙装饰。
测试

3.5. 间隙装饰重叠:rule-overlap 属性

名称: rule-overlap
值: row-over-column | column-over-row
初始值: row-over-column
适用对象: grid 容器flex 容器,以及 grid lanes 容器
可继承:
百分比: n/a
计算值: 按指定
规范顺序: 与语法一致
动画类型: 离散

该属性用于设置重叠的间隙装饰的绘制顺序。

row-over-column
行方向装饰绘制在列方向装饰之上。
column-over-row
列方向装饰绘制在行方向装饰之上。
.row-over-column {
  rule-overlap: row-over-column;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
}
row-over-column 间隙装饰重叠。
.column-over-row {
  rule-overlap: column-over-row;
  row-rule: 6px solid red;
  column-rule: 6px solid blue;
}
column-over-row 间隙装饰重叠。
测试

3.6. 分片

CSS Box Alignment 3 § 8.1 Row and Column Gutters: the row-gap and column-gap properties 指出,当间隙与一个 分片断点 重合时,间隙会消失。 因为在这些位置没有间隙, 因此也不会在其中绘制任何 间隙装饰

Tests

4. 颜色、样式与宽度

本节中的属性定义取代在 [CSS-MULTICOL-1] 中具有相同名称的属性定义。

4.1. 间隙装饰颜色:column-rule-color, row-rule-color, 和 rule-color 属性

Name: column-rule-color, row-rule-color
Value: <line-color-list> | <auto-line-color-list>
Initial: currentcolor
Applies to: grid 容器, flex 容器, 多列容器, 以及 grid lanes 容器
Inherited: no
Percentages: n/a
Computed value: 按指定
Canonical order: 与语法一致
Animation type: 可重复的列表,见 § 4.7 列表值的插值
<line-color-list>          = <line-color-or-repeat>#

<auto-line-color-list>     = <line-color-or-repeat>#? ,
                             <auto-repeat-line-color> ,
                             <line-color-or-repeat>#?

<line-color-or-repeat>     = [ <color> | <repeat-line-color> ]

<repeat-line-color>        = repeat( [ <integer [1,∞]> ] , [ <color> ]# )

<auto-repeat-line-color>   = repeat( auto , [ <color> ]# )

这些属性设置 间隙装饰 的颜色。

Name: rule-color
Value: <'column-rule-color'>
Initial: 见各自属性
Applies to: column-rule-colorrow-rule-color 相同
Inherited: no
Percentages: 见各自属性
Computed value: 见各自属性
Animation type: 见各自属性
Canonical order: 与语法一致

简写属性会把 column-rule-colorrow-rule-color 设置为相同的值。

Tests

4.2. 间隙装饰样式:The column-rule-style, row-rule-style, and rule-style 属性

Name: column-rule-style, row-rule-style
Value: <line-style-list> | <auto-line-style-list>
Initial: none
Applies to: grid 容器, flex 容器, multicol 容器, and grid lanes 容器
Inherited: no
Percentages: n/a
Computed value: as specified
Canonical order: per grammar
Animation type: discrete
<line-style-list>          = <line-style-or-repeat>#

<auto-line-style-list>     = <line-style-or-repeat>#? ,
                             <auto-repeat-line-style> ,
                             <line-style-or-repeat>#?

<line-style-or-repeat>     = [ <line-style> | <repeat-line-style> ]

<repeat-line-style>        = repeat( [ <integer [1,∞]> ] , [ <line-style> ]# )

<auto-repeat-line-style>   = repeat( auto , [ <line-style> ]# )

这些属性设置 间隙装饰 的样式。 The <line-style> 值的应用方式与 border-style 相同。

Name: rule-style
Value: <'column-rule-style'>
Initial: see individual properties
Applies to: Same as column-rule-style and row-rule-style
Inherited: no
Percentages: see individual properties
Computed value: see individual properties
Animation type: see individual properties
Canonical order: per grammar

简写属性会把 column-rule-stylerow-rule-style 设置为相同的值。

测试

4.3. 间隙装饰宽度:The column-rule-width, row-rule-width, and rule-width 属性

Name: column-rule-width, row-rule-width
Value: <line-width-list> | <auto-line-width-list>
Initial: medium
Applies to: grid 容器, flex 容器, multicol 容器, and grid lanes 容器
Inherited: no
Percentages: n/a
Computed value: 绝对长度的列表,按边框宽度进行取整
Canonical order: per grammar
Animation type: repeatable list, see § 4.7 Interpolation of list values.
<line-width-list>          = <line-width-or-repeat>#

<auto-line-width-list>     = <line-width-or-repeat>#? ,
                             <auto-repeat-line-width> ,
                             <line-width-or-repeat>#?

<line-width-or-repeat>     = [ <line-width> | <repeat-line-width> ]

<repeat-line-width>        = repeat( [ <integer [1,∞]> ] , [ <line-width> ]# )

<auto-repeat-line-width>   = repeat( auto , [ <line-width> ]# )

这些属性设置 间隙装饰 的宽度。 不允许使用负值。

Name: rule-width
Value: <'column-rule-width'>
Initial: see individual properties
Applies to: Same as column-rule-width and row-rule-width
Inherited: no
Percentages: see individual properties
Computed value: see individual properties
Animation type: see individual properties
Canonical order: per grammar

简写属性会把 column-rule-widthrow-rule-width 设置为相同的值。

测试

4.4. 间隙装饰简写:column-rulerow-rulerule 属性

名称: column-rule, row-rule
值: <gap-rule-list> | <gap-auto-rule-list>
初始值: 见各自属性
适用于: 见各自属性
可继承: 见各自属性
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法一致
<gap-rule-list>        = <gap-rule-or-repeat>#

<gap-auto-rule-list>   = <gap-rule-or-repeat>#? ,
                         <gap-auto-repeat-rule> ,
                         <gap-rule-or-repeat>#?

<gap-rule-or-repeat>   = <gap-rule> | <gap-repeat-rule>

<gap-repeat-rule>      = repeat( <integer [1,∞]> , <gap-rule># )

<gap-auto-repeat-rule> = repeat( auto , <gap-rule># )

<gap-rule>             = <line-width> || <line-style> || <color>

这些 简写属性 分别为 column-rule-widthcolumn-rule-stylecolumn-rule-color 属性, 或者分别为 row-rule-widthrow-rule-stylerow-rule-color 属性设置值。

名称: rule
值: <'column-rule'>
初始值: 见各自属性
适用于: column-rulerow-rule 相同
可继承: no
百分比: 见各自属性
计算值: 见各自属性
动画类型: 见各自属性
规范顺序: 与语法一致

简写属性 会把 column-rulerow-rule 设为相同的值。

测试

4.5. 值列表与 repeat() 表示法

本节中的每个属性都接受以逗号分隔的值列表。 以这种方式设置多个值允许在给定容器内对间隙装饰进行变化。

作者可能会按如下方式指定交替的红色与蓝色列装饰:
column-rule-width: 1px;
column-rule-style: solid;
column-rule-color: red, blue;

这样的列表可以包含 repeat() 表示法。 与 CSS Grid Layout 1 § 7.2.3 重复行与列:repeat() 表示法 类似,这些表示法允许将表现出重复模式的一系列间隙装饰以更紧凑的形式书写。

repeat() 语法的通用形式大致为:

repeat( [ <integer [1,∞]> | auto ] , <value># )

repeat() 的第一个参数指定重复次数。

<integer>
指定一个 整数重复器。 一个 整数重复器 会将第二个参数中的值列表展开为按第一个参数指定次数重复的序列。
作者可以写入:
column-rule-color: gray, red, blue, red, blue, red, blue, gray;
或者缩写为下列形式,产生相同的颜色序列:
column-rule-color: gray, repeat(3, red, blue), gray;
auto
指定一个 自动重复器。 一个 自动重复器 将用于填充那些 否则不会从列表其他部分获得值的间隙。 在给定的值列表中,最多只能有一个 repeat() 被用作 自动重复器
延续前例,如果作者不知道最终布局中会有多少列,他们可能会改写为:
column-rule-color: gray, repeat(auto, red, blue), gray;
这将使第一列与最后一列的间隙装饰为灰色, 而中间的列间隙则交替为红与蓝。

repeat() 的第二个参数是一个以逗号分隔的值列表, 该列表中的值是属性(即包含该 repeat() 的属性)所接受的值。

4.6. 将间隙装饰值分配给间隙

间隙装饰在应用 分配 之前,会先应用 间隙折叠。 给定的一组 折叠间隙 恰好消耗一个 间隙装饰;下一个 间隙装饰 会应用到下一个间隙(或下一组 折叠间隙)。 因此,对于装饰目的,折叠间隙 被视为单个 间隙

要把 间隙装饰值分配 给一列 gaps,使用一列 values
  1. values 中的任何 整数重复器 替换为其展开后的等价项。
  2. 如果列表不包含任何 自动重复器,则:
    1. values 的第一个项与 gaps 的第一个项开始, 将每个值分配给对应的间隙。 如果值的数量少于间隙的数量, 则从 values 的第一项重新开始重复, 直到满足需要为止。
    2. 结束此算法。
  3. values 包含一个 自动重复器。 令 leading countvalues 中在 自动重复器 之前的项数。 令 trailing countvalues 中在 自动重复器 之后的项数。
  4. 按如下方式对 gaps 进行划分:
    1. leading gaps 包含 gaps 中的前 leading count 项。
    2. trailing gaps 包含 gaps 中的最后 trailing count 项, 并排除任何属于 leading gaps 的项。
    3. auto gaps 包含 gaps 中既不在 leading gaps 也不在 trailing gaps 中的项。
  5. 如果 leading gaps 非空, 将间隙装饰值分配leading gaps, 使用 values 中的前 leading count 项。
  6. 如果 trailing gaps 非空, 将间隙装饰值分配trailing gaps, 使用 values 中的前 trailing count 项。
  7. 如果 auto gaps 非空, 将间隙装饰值分配auto gaps, 使用 自动重复器 的第二个参数中的值列表。
测试

4.7. 列表值的插值

在对 repeat() 值,或 rule-colorrule-width 的值列表进行插值时,插值分两步进行:
  1. 展开:将任何 整数重复器 展开为其等价的值列表。
  2. 列表插值:对展开后的列表应用 可重复列表 的插值算法,逐项与对应项进行插值。
@keyframes example {
  from { column-rule-width: 10px; }
  to   { column-rule-width: 20px, 40px; }
}
上述值的插值会将“from”和“to”值展开为等长的列表,从而得到:
From:   10px, 10px
At 50%: 15px, 25px
To:     20px, 40px
@keyframes example {
  from { column-rule-width: repeat(2, 5px, 10px); }
  to   { column-rule-width: repeat(2, 15px, 20px); }
}
上述值的插值会将“from”和“to”值展开为等长的列表,从而得到:
From:    5px, 10px,  5px, 10px
At 50%: 10px, 15px, 10px, 15px
To:     15px, 20px, 15px, 20px
@keyframes example {
  from { column-rule-width: repeat(2, 10px, 20px); }
  to   { column-rule-width: 20px; }
}
上述值的插值会将“from”和“to”值展开为等长的列表,从而得到:
From:   10px, 20px, 10px, 20px
At 50%: 15px, 20px, 15px, 20px
To:     20px, 20px, 20px, 20px
@keyframes example {
  from { column-rule-width: repeat(2, 10px, 20px); }
  to   { column-rule-width: 20px, 30px; }
}
上述值的插值会将“from”和“to”值展开为等长的列表,从而得到:
From:   10px, 20px, 10px, 20px
At 50%: 15px, 25px, 15px, 25px
To:     20px, 30px, 20px, 30px

当我们要在其间插值的任一列表(fromto)包含一个 自动重复器 时:

  1. fromto 各自分割为若干段,方式与我们在 分配间隙装饰值 时的分割类似:
    1. leading values自动重复器 之前的值。
    2. trailing values自动重复器 之后的值。
    3. auto values 为位于 自动重复器 内的值。
  2. 如果只有 fromto 中的一个包含自动重复器,则退回到 离散 插值。
  3. 展开每个段中的任何整数重复器。
  4. 如果 fromleading values 的长度与 toleading values 的长度不匹配,则退回到 离散 插值。 如果 fromtrailing values 的长度与 totrailing values 的长度不匹配,则同样退回到 离散 插值。
  5. fromto 都包含自动重复器,且其段的长度按上述方式匹配时, 对每个 auto values 中的值列表应用 可重复列表 插值算法。
@keyframes example {
  from { column-rule-width: 10px, repeat(auto, 20px), 30px }
  to   { column-rule-width: 20px, repeat(auto, 40px), 40px }
}
across fromtoleading valuestrailing values 长度匹配, 因此我们可以对每个段应用 可重复列表 算法。
From:   10px, repeat(auto, 20px), 30px
At 50%: 15px, repeat(auto, 30px), 35px
To:     20px, repeat(auto, 40px), 40px
@keyframes example {
  from { column-rule-width: 10px, 20px, repeat(auto, 20px), 30px }
  to   { column-rule-width: 20px, 30px, repeat(auto, 40px, 50px), 40px }
}
across fromtoleading valuestrailing values 长度匹配, 因此我们可以对每个段应用 可重复列表 算法。
From:   10px, 20px, repeat(auto, 20px, 20px), 30px
At 50%: 15px, 25px, repeat(auto, 30px, 35px), 35px
To:     20px, 30px, repeat(auto, 40px, 50px), 40px
@keyframes example {
  from { column-rule-width: 10px, repeat(auto, 20px) }
  to   { column-rule-width: 20px, 30px, repeat(auto, 40px, 50px) }
}
fromleading valuestoleading values 长度不匹配, 因此我们退回到 离散 插值。
@keyframes example {
  from { column-rule-width: 10px, repeat(auto, 20px), 30px }
  to   { column-rule-width: 20px, repeat(auto, 40px), 40px, 50px }
}
fromtrailing valuestotrailing values 长度不匹配, 因此我们退回到 离散 插值。
@keyframes example {
  from { column-rule-width: 10px, repeat(auto, 20px), 30px }
  to   { column-rule-width: 20px }
}
from 包含一个 自动重复器,因此我们退回到 离散 插值。
Tests

4.8. 序列化

仅当组件长属性是 重复器对齐 时,column-rulerow-rulerule 简写才会从对应的长属性序列化出来。 如果长属性不是 重复器对齐,则该简写的序列化结果为空字符串。

WSC 分别为宽度、样式与颜色长属性的值。回想它们都是项的列表,其中每一项要么是单个值,要么是一个 repeat() 表示法。 当且仅当下列所有条件都为真时,长属性被称为 重复器对齐
  1. WSC 的项数相同。
  2. 对于每个项索引 iW[i]、S[i] 和 C[i] 具有相同的形态:
    1. 它们要么全是非重复值,要么全是 整数重复器,要么全是 自动重复器
    2. 若它们是 整数重复器,则这些 <integer> 值相等。
    3. 每个 repeat() 表示法包含相同数量的值。
该简写声明:
column-rule: 1px solid red, 2px dashed green, 3px dotted blue;

拆分得到如下长属性值:

column-rule-width: 1px, 2px, 3px;
column-rule-style: solid, dashed, dotted;
column-rule-color: red, green, blue;

由于长属性是 重复器对齐(三者均有相同的项数(3),且每项都是单个值), 它们会被序列化回相同的原始简写值。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

该简写声明:
column-rule: 1px solid red, repeat(2, 2px dashed green);

拆分得到如下长属性值:

column-rule-width: 1px, repeat(2, 2px);
column-rule-style: solid, repeat(2, dashed);
column-rule-color: red, repeat(2, green);

由于长属性是 重复器对齐(三者均有相同的项数(2),且在每个索引处项类型匹配——索引 0 为单值,索引 1 为整数重复器;整数重复器的重复计数相同且包含相同数量的值), 它们会被序列化回相同的原始简写值。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

该简写声明:
column-rule: repeat(auto, 1px solid red, 2px dashed green);

拆分得到如下长属性值:

column-rule-width: repeat(auto, 1px, 2px);
column-rule-style: repeat(auto, solid, dashed);
column-rule-color: repeat(auto, red, green);

由于长属性是 重复器对齐(三者均有相同的项数(1),每项是自动重复器,且自动重复器包含相同数量的值(2)), 它们会被序列化回相同的原始简写值。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

这些声明:
column-rule: repeat(auto, 1px solid red, 2px dashed green);
column-rule-width: repeat(auto, 3px, 4px, 5px);

拆分得到如下长属性值:

column-rule-width: repeat(auto, 3px, 4px, 5px);
column-rule-style: repeat(auto, solid, dashed);
column-rule-color: repeat(auto, red, green);

由于长属性不是 重复器对齐(自动重复器包含不同数量的值),column-rule 简写将在序列化时输出为空字符串。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

这些声明:
column-rule: repeat(2, 1px solid red, 2px dashed green);
column-rule-style: dashed, dotted, solid;

拆分得到如下长属性值:

column-rule-width: repeat(2, 1px, 2px);
column-rule-style: dashed, dotted, solid;
column-rule-color: repeat(2, red, green);

由于长属性不是 重复器对齐(在索引 0 处项的类型不匹配——宽度与颜色为整数重复器,而样式为单值),column-rule 简写将在序列化时输出为空字符串。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

这些声明:
column-rule: repeat(2, 1px solid red, 2px dashed green);
column-rule-color: repeat(4, red, cyan);

拆分得到如下长属性值:

column-rule-width: repeat(2, 1px, 2px);
column-rule-style: repeat(2, solid, dashed);
column-rule-color: repeat(4, red, cyan);

由于长属性不是 重复器对齐(整数重复器的重复计数不同),column-rule 简写将在序列化时输出为空字符串。

如果直接指定这三个长属性(而不是来自简写),也会产生相同的行为。

Tests

5. 致谢

本规范得以实现要归功于许多人的贡献和反馈,包括: Ahmad Shadeed, Alison Maher, Benoît Rouleau, Elika Etemad, Ian Kilpatrick, Javier Contreras Tenorio, Josh Tumath, Kurt Catti-Schmidt, Lea Verou, Oliver Williams, Rachel Andrew, Sam Davis Omekara Jr., Sebastian Zartner, Tab Atkins-Bittner, and the CSS Working Group members. 特别感谢 Mats Palmgren 起草了间隙装饰的初步提案。

6. 隐私注意事项

本规范尚未报告新的隐私注意事项。

7. 安全注意事项

本规范尚未报告新的安全注意事项。

8. 更改

8.1. 17 April 2025 Working Draft 以来的更改

符合性

文档约定

符合性要求通过描述性断言与 RFC 2119 术语的组合来表达。术语 “MUST”、 “MUST NOT”、 “REQUIRED”、 “SHALL”、 “SHALL NOT”、 “SHOULD”、 “SHOULD NOT”、 “RECOMMENDED”、 “MAY” 和 “OPTIONAL” 在本文档的规范性部分中应按 RFC 2119 中的描述进行解释。 不过,为了可读性,这些词在本规范中并不全部以大写形式出现。

本规范的全部文本均为规范性内容,除非明确标注为非规范性、示例或注释的章节。 [RFC2119]

本规范中的示例以“for example”一词引入,或以 class="example" 与规范性文本区分开来,如下所示:

这是一个说明性的示例。

说明性注释以单词 “Note” 开头,并以 class="note" 与规范性文本区分开来,如下所示:

注意:这是一个说明性注释。

Advisements 是为引起特别注意而样式化的规范性章节,并以 <strong class="advisement"> 与其他规范性文本区分开来,如下所示: 用户代理(UAs)必须提供可访问的替代方案。

Tests

与本规范内容相关的测试可以像这样记录在“Tests”块中。 任何此类块均为非规范性的。


符合性类别

对本规范的符合性 被定义为三类符合性:

style sheet
一个 CSS 样式表
renderer
解释样式表语义并渲染使用它们的文档的 用户代理(UA)
authoring tool
用于编写样式表的 用户代理(UA)

如果样式表中使用了本模块定义语法的所有声明,均符合通用 CSS 语法以及本模块中每个特性的各自语法,则该样式表视为符合本规范。

如果渲染器在解释样式表方面遵循适当规范的定义,并且能够正确解析并支持本规范定义的所有特性并据此渲染文档,则该渲染器视为符合本规范。 但是,由于设备限制导致用户代理无法正确渲染某些文档并不表示该用户代理不符合规范。(例如,在单色显示器上并不要求用户代理渲染颜色。)

如果创作工具所生成的样式表在语法上符合通用 CSS 语法以及本模块中每个特性的各自语法,并满足本模块中所述样式表的所有其他符合性要求,则该创作工具视为符合本规范。

部分实现

为了使作者能够利用向前兼容的解析规则来指定回退值,CSS 渲染器 必须 将其没有可用支持级别的任何 at-rule、属性、属性值、关键字和其他语法构造视为无效(并在适当时 忽略)。特别地,用户代理 不得 在单个多值属性声明中有选择地忽略不受支持的组件值并接受受支持的值:如果任何值被视为无效(如不受支持的值必须被视为无效),CSS 要求整个声明被忽略。

不稳定与专有特性的实现

为避免与将来的稳定 CSS 特性发生冲突, CSS 工作组建议在实现 不稳定 特性和 CSS 的专有扩展 时遵循 最佳实践

非实验性实现

一旦规范进入候选推荐(Candidate Recommendation)阶段, 非实验性实现便成为可能,实现者应在能够证明符合规范正确实现的任何 CR 级功能时, 发布不带前缀的实现。

为了建立并维护跨实现的 CSS 互操作性,CSS 工作组请求非实验性的 CSS 渲染器在发布任何不带前缀的实现之前向 W3C 提交实现报告(如有必要,还应提交用于该实现报告的测试用例)。提交给 W3C 的测试用例将由 CSS 工作组审查并予以修正。

有关提交测试用例和实现报告的更多信息,请参阅 CSS 工作组网站: https://www.w3.org/Style/CSS/Test/。 如有问题,请发邮件至 public-css-testsuite@w3.org

索引

本规范定义的术语

通过引用定义的术语

参考文献

规范性参考文献

[CSS-ALIGN-3]
Elika Etemad; Tab Atkins Jr.. CSS Box Alignment Module Level 3. 30 January 2026. WD. URL: https://www.w3.org/TR/css-align-3/
[CSS-BACKGROUNDS-3]
Elika Etemad; Brad Kemper. CSS Backgrounds and Borders Module Level 3. 11 March 2024. CRD. URL: https://www.w3.org/TR/css-backgrounds-3/
[CSS-BREAK-4]
Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 4. 18 December 2018. FPWD. URL: https://www.w3.org/TR/css-break-4/
[CSS-CASCADE-5]
Elika Etemad; Miriam Suzanne; Tab Atkins Jr.. CSS Cascading and Inheritance Level 5. 13 January 2022. CR. URL: https://www.w3.org/TR/css-cascade-5/
[CSS-COLOR-5]
Chris Lilley; Una Kravets; Lea Verou. CSS Color Module Level 5. 27 February 2026. WD. URL: https://www.w3.org/TR/css-color-5/
[CSS-FLEXBOX-1]
Elika Etemad; Tab Atkins Jr.; Rossen Atanassov. CSS Flexible Box Layout Module Level 1. 14 October 2025. CRD. URL: https://www.w3.org/TR/css-flexbox-1/
[CSS-GRID-1]
Tab Atkins Jr.; et al. CSS Grid Layout Module Level 1. 26 March 2025. CRD. URL: https://www.w3.org/TR/css-grid-1/
[CSS-GRID-2]
Tab Atkins Jr.; et al. CSS Grid Layout Module Level 2. 26 March 2025. CRD. URL: https://www.w3.org/TR/css-grid-2/
[CSS-GRID-3]
Tab Atkins Jr.; et al. CSS Grid Layout Module Level 3. 21 January 2026. WD. URL: https://www.w3.org/TR/css-grid-3/
[CSS-MULTICOL-1]
Florian Rivoal; Rachel Andrew. CSS Multi-column Layout Module Level 1. 16 May 2024. CR. URL: https://www.w3.org/TR/css-multicol-1/
[CSS-MULTICOL-2]
Florian Rivoal; Rachel Andrew. CSS Multi-column Layout Module Level 2. 19 December 2024. FPWD. URL: https://www.w3.org/TR/css-multicol-2/
[CSS-VALUES-3]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 22 March 2024. CRD. URL: https://www.w3.org/TR/css-values-3/
[CSS-VALUES-4]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4. 12 March 2024. WD. URL: https://www.w3.org/TR/css-values-4/
[CSS2]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[WEB-ANIMATIONS-1]
Brian Birtles; et al. Web Animations. 5 June 2023. WD. URL: https://www.w3.org/TR/web-animations-1/

非规范性参考文献

[CSS-GAPS-1]
Kevin Babbitt. CSS Gap Decorations Module Level 1. 17 April 2025. FPWD. URL: https://www.w3.org/TR/css-gaps-1/

属性索引

名称 初始值 适用对象 继承 百分比 动画类型 规范顺序 计算值
column-rule <gap-rule-list> | <gap-auto-rule-list> 见各自属性 见各自属性 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-break none | normal | intersection normal grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 离散 与语法一致 按指定
column-rule-color <line-color-list> | <auto-line-color-list> currentcolor grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 可重复列表,见 . 与语法一致 按指定
column-rule-edge-inset <length-percentage> [ <length-percentage> ]? 见各自属性 与 column-rule-edge-inset-start、column-rule-edge-inset-end、 column-rule-interior-inset-start、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-edge-inset-end、row-rule-interior-inset-start 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-edge-inset-end <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
column-rule-edge-inset-start <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
column-rule-inset <'column-rule-edge-inset'> [ / <'column-rule-interior-inset'> ]? 见各自属性 与 column-rule-edge-inset、column-rule-interior-inset、row-rule-edge-inset 和 row-rule-interior-inset 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-inset-end <length-percentage> 见各自属性 与 column-rule-edge-inset-start、column-rule-interior-inset-start、 column-rule-edge-inset-end、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-interior-inset-start、row-rule-edge-inset-end 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-inset-start <length-percentage> 见各自属性 与 column-rule-edge-inset-start、column-rule-interior-inset-start、 column-rule-edge-inset-end、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-interior-inset-start、row-rule-edge-inset-end 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-interior-inset <length-percentage> [ <length-percentage> ]? 见各自属性 与 column-rule-edge-inset-start、column-rule-edge-inset-end、 column-rule-interior-inset-start、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-edge-inset-end、row-rule-interior-inset-start 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
column-rule-interior-inset-end <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
column-rule-interior-inset-start <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
column-rule-style <line-style-list> | <auto-line-style-list> none grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 离散 与语法一致 按指定
column-rule-visibility-items all | around | between all grid 容器,以及多列容器 n/a 离散 与语法一致 按指定
column-rule-width <line-width-list> | <auto-line-width-list> medium grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 可重复列表,见 . 与语法一致 绝对长度的列表,按边框宽度进行取整
row-rule <gap-rule-list> | <gap-auto-rule-list> 见各自属性 见各自属性 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-break none | normal | intersection normal grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 离散 与语法一致 按指定
row-rule-color <line-color-list> | <auto-line-color-list> currentcolor grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 可重复列表,见 . 与语法一致 按指定
row-rule-edge-inset <length-percentage> [ <length-percentage> ]? 见各自属性 与 column-rule-edge-inset-start、column-rule-edge-inset-end、 column-rule-interior-inset-start、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-edge-inset-end、row-rule-interior-inset-start 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-edge-inset-end <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
row-rule-edge-inset-start <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
row-rule-inset <'column-rule-edge-inset'> [ / <'column-rule-interior-inset'> ]? 见各自属性 与 column-rule-edge-inset、column-rule-interior-inset、row-rule-edge-inset 和 row-rule-interior-inset 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-inset-end <length-percentage> 见各自属性 与 column-rule-edge-inset-start、column-rule-interior-inset-start、 column-rule-edge-inset-end、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-interior-inset-start、row-rule-edge-inset-end 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-inset-start <length-percentage> 见各自属性 与 column-rule-edge-inset-start、column-rule-interior-inset-start、 column-rule-edge-inset-end、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-interior-inset-start、row-rule-edge-inset-end 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-interior-inset <length-percentage> [ <length-percentage> ]? 见各自属性 与 column-rule-edge-inset-start、column-rule-edge-inset-end、 column-rule-interior-inset-start、column-rule-interior-inset-end、row-rule-edge-inset-start、 row-rule-edge-inset-end、row-rule-interior-inset-start 和 row-rule-interior-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
row-rule-interior-inset-end <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
row-rule-interior-inset-start <length-percentage> 0 grid 容器、flex 容器、多列容器,以及 grid lanes 容器 参见 crossing gap width 按计算值类型 与语法一致 按指定
row-rule-style <line-style-list> | <auto-line-style-list> none grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 离散 与语法一致 按指定
row-rule-visibility-items all | around | between all grid 容器,以及多列容器 n/a 离散 与语法一致 按指定
row-rule-width <line-width-list> | <auto-line-width-list> medium grid 容器、flex 容器、多列容器,以及 grid lanes 容器 n/a 可重复列表,见 . 与语法一致 绝对长度的列表,按边框宽度进行取整
rule <'column-rule'> 见各自属性 与 column-rule 和 row-rule 相同 见各自属性 见各自属性 与语法一致 见各自属性
rule-break <'column-rule-break'> 见各自属性 与 column-rule-break 和 row-rule-break 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-color <'column-rule-color'> 见各自属性 与 column-rule-color 和 row-rule-color 相同 见各自属性 见各自属性 与语法一致 见各自属性
rule-edge-inset <'column-rule-edge-inset'> 见各自属性 与 column-rule-edge-inset 和 row-rule-edge-inset 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-inset <'column-rule-inset'> 见各自属性 与 column-rule-inset 和 row-rule-inset 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-inset-end <'column-rule-inset-end'> 见各自属性 与 column-rule-inset-end 和 row-rule-inset-end 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-inset-start <'column-rule-inset-start'> 见各自属性 与 column-rule-inset-start 和 row-rule-inset-start 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-interior-inset <'column-rule-interior-inset'> 见各自属性 与 column-rule-interior-inset 和 row-rule-interior-inset 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-overlap row-over-column | column-over-row row-over-column grid 容器、flex 容器,以及 grid lanes 容器 n/a 离散 与语法一致 按指定
rule-style <'column-rule-style'> 见各自属性 与 column-rule-style 和 row-rule-style 相同 见各自属性 见各自属性 与语法一致 见各自属性
rule-visibility-items <'column-rule-visibility-items'> 见各自属性 与 column-rule-visibility-items 和 row-rule-visibility-items 相同 见各自属性 见各自属性 见各自属性 与语法一致 见各自属性
rule-width <'column-rule-width'> 见各自属性 与 column-rule-width 和 row-rule-width 相同 见各自属性 见各自属性 与语法一致 见各自属性