column-rule-break CSS property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The column-rule-break CSS property sets the behavior for breaking column rules into segments wherever column rules intersect row gaps.
Try it
column-rule-break: none;
column-rule-break: normal;
column-rule-break: intersection;
<section id="default-example">
<div id="example-element">
<i>A</i>
<i>B</i>
<i>C</i>
<i>D</i>
<i>E</i>
<i>F</i>
<i>G</i>
<i>H</i>
<i>I</i>
<i>J</i>
<i>K</i>
<i>L</i>
<i>M</i>
<i>N</i>
<i>O</i>
<i>P</i>
<i>Q</i>
<i>R</i>
<i>S</i>
<i>T</i>
<i>U</i>
<i>V</i>
<i>W</i>
<i>X</i>
<i>Y</i>
<i>Z</i>
</div>
</section>
#example-element {
display: grid;
grid-template-columns: repeat(7, 1fr);
column-rule: solid thick orange;
row-rule: solid thick lavender;
gap: 15px;
rule-overlap: column-over-row;
}
#example-element i {
padding: 5px;
}
Syntax
/* Keywords */
column-rule-break: none;
column-rule-break: normal;
column-rule-break: intersection;
/* Global values */
column-rule-break: inherit;
column-rule-break: initial;
column-rule-break: revert;
column-rule-break: revert-layer;
column-rule-break: unset;
Values
This property is specified as a single keyword from the following list:
none-
There are no breaks in column rules when they intersect row gaps; rather, a continuous column rule is painted the whole height of the container, from edge to edge.
normal-
In grid and flex containers, behaves as
none. In multi-col, behaves asintersection. This is the default value. intersection-
Column rules always break when they intersect row gaps, with column rule segments starting and ending at container and gap edges.
Description
The column-rule-break property specifies whether or not to break column rules into segments when they cross row gaps.
Column rules are painted within a column gap as one or more segments, with segments occurring between adjacent grid items in separate columns, between flex items or flex lines in flex layouts depending on the flex-direction, or between columns in multi-col layouts.
The column-rule-break property only determines if the break occurs. By default, the break between column rule segments is the height of the row gap, as each segment starts and ends at the edge of the gap (or edge of the container). If the row gap is 0, this break may not be visible. The end positions can be controlled with the column-rule-inset properties.
If column-rule-break is set to none, there are no breaks. In this case, the column rule line is continuous, and any column-rule-inset values only affect the left and right edges of the column rule at the container's edge. When there are breaks, the column-rule-inset properties affect the start and end of every column rule segment.
The column-rule-break property, along with the row-rule-break property, can be set using the rule-break shorthand.
Whether a column rule is by default composed of a single continuous segment or segments that break when intersecting row gaps depends on the container type.
Grid containers
In grid containers, by default, column rule segments continue through row gap intersections, equivalent to column-rule-break: none. Setting column-rule-break: intersection forces the segments to break at every row gap they would otherwise cross.
By default, there are no column rule breaks. Check the checkbox to set the column-rule-break to intersection, which makes the otherwise continuous rules break at every "cross" intersection. By default, the break between segments is the height of the row-gap, which was set to 20px in this case.
Flex containers
In flexbox, whether the column rules break at every row gap by default depends on the flex-direction. In horizontal writing modes, when set to row or row-reverse, the column rule breaks at every row gap, equivalent to column-rule-break: intersection. When the flex-direction is column or column-reverse, the column rule is continuous by default, equivalent to column-rule-break: none.
In horizontal wrting modes, setting the column-rule-break to intersection only impacts the column rules in the column and column-reverse scenarios.
Multi-col containers
In multi-col containers, the default normal value behaves the same as intersection. While the row decorations are continuous by default, column rules break at every intersection. Column rules break into segments at every row gap, with each segment starting and ending at the edge of the gap. These start and end positions can be changed with the column-rule-inset properties.
If you select none, the column rule will no longer break into segments; rather, it will continue from the top of the container, until it reaches the bottom edge. The column-rule-inset properties can be used to offset the ends of the column gap decorations.
Formal definition
Value not found in DB!Formal syntax
column-rule-break =
none |
normal |
intersection
Examples
>Basic usage
In this example, we use the column-rule-break property to break each rule segment in a grid container so column rule segments are created between row gaps. Changing the row-gap property will change the size of the segments.
HTML
We create a list of 50 items and a slider to select the row gap width. Most of the HTML is hidden for brevity.
<ul>
<li>1</li>
<li>2</li>
...
<li>49</li>
<li>50</li>
</ul>
CSS
We define the unordered list as a 8-column container, creating rows and columns with the grid-template-columns property and setting list-style-type to none to remove the bullets. We include a gap of 20px to provide enough room between the rows and columns to fit our 20px solid row and column rules. We include the rule-overlap property to paint the column decoration on top of any row decorations. Last, we set the column rules to break at every intersection.
ul {
display: grid;
grid-template-columns: repeat(8, 1fr);
list-style-type: none;
gap: 20px;
column-rule: 10px solid olive;
row-rule: 10px solid palegoldenrod;
rule-overlap: column-over-row;
column-rule-break: intersection;
}
The rest of the CSS is hidden for brevity.
Result
Make the row gaps wider and note how the breaks between column segments grow. Bring the row gap width down to 0px, and notice how the column decoration appears continuous. It isn't! The 0px gap between segments may not be visible, but the segments still start and end at the gap, so any offsets set with column-rule-inset properties will still be applied.
Specifications
| Specification |
|---|
| CSS Gaps Module Level 1> # propdef-column-rule-break> |
Browser compatibility
See also
row-rule-breakrule-breakshorthandrule-insetshorthandrule-overlaprule-visibility-itemsruleshorthand- CSS gaps module