row-rule-inset-junction-end 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 row-rule-inset-junction-end CSS property can be used to offset the end edge of row rule segments that are junction endpoints, that is, endpoints at gap junctions where rule segments intersect.
Try it
row-rule-inset-junction-end: 0;
row-rule-inset-junction-end: 0.5em;
row-rule-inset-junction-end: 5px;
row-rule-inset-junction-end: -50%;
row-rule-inset-junction-end: overlap-join;
<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 id="u">U</i>
<i id="x">X</i>
<i id="y">Y</i>
<i id="bang">!</i>
</div>
</section>
#example-element {
display: grid;
grid-template-columns: repeat(5, 1fr);
rule: solid thick lightpink;
row-rule-color: magenta;
row-rule-break: intersection;
gap: 1.5em;
rule-overlap: row-over-column;
border: 1px solid rebeccapurple;
margin: auto;
rule-visibility-items: around;
}
#example-element i {
padding: 8px;
border: 1px dashed;
}
#u {
grid-row: 3 / 4;
grid-column: 7 / 8;
}
#y {
grid-row: 4 / 5;
grid-column: 4 / 5;
}
#x {
grid-column: 3 / 4;
grid-row: 4 / 5;
}
#bang {
grid-column: 6 / 7;
grid-row: 4 / 5;
}
Syntax
/* Keywords */
row-rule-inset-junction-end: overlap-join;
/* <length-percentage> values */
row-rule-inset-junction-end: 0;
row-rule-inset-junction-end: 1em;
row-rule-inset-junction-end: -5px;
row-rule-inset-junction-end: -25%;
/* Global values */
row-rule-inset-junction-end: inherit;
row-rule-inset-junction-end: initial;
row-rule-inset-junction-end: revert;
row-rule-inset-junction-end: revert-layer;
row-rule-inset-junction-end: unset;
Values
This property is specified as a single value from the following list:
overlap-join-
Specifies that the junction segment should extend across the column-rule, resolving to half the
column-gapvalue plus half the usedcolumn-rule-widthvalue. <length-percentage>-
Specifies the size of the inset. Percentage values are relative to the junction endpoint, which is the
column-gapvalue.
Description
The row-rule-inset-junction-end property can be used to inset or outset junction segment endpoints occurring at the end of row rule segments. The default value is 0. Positive values reduce the segment size, while negative values and the overlap-join keyword increase it.
Row rules are painted within a row gap as one or more segments, with segments occurring between:
- Adjacent rows in CSS grid layouts.
- Adjacent flex items or flex lines in flex layouts, depending on the
flex-direction. - Adjacent rows in multi-col layouts, which may exist when
column-heightis set to a<length>.
Whether a row rule spans multiple columns or is broken into multiple segments is defined by the row-rule-break property. Interior breaks between row rule segments are the size of the column-gap. A junction end occurs at the end of every row segment where the segment ends at a gap junction with other row or rule segments present.
The row-rule-inset-junction-end property is a constituent property of several shorthand properties:
-
To inset both the left and right row segment junction endpoints, the
row-rule-inset-junction-endproperty, along with therow-rule-inset-junction-startproperty, can be set using therow-rule-inset-junctionshorthand. -
To inset all end row segment endpoints, the
row-rule-inset-junction-endproperty, along with therow-rule-inset-cap-endproperty, can be set using therow-rule-inset-endshorthand. -
To inset the top, bottom, left, and right segment junction endpoints the
row-rule-inset-junctionshorthand property, along with thecolumn-rule-inset-junctionshorthand property, can be set using therule-inset-junctionshorthand.
All segment endpoints, including this property's -start, -cap, and column- equivalents, can be set using the rule-inset shorthand.
Understanding junction endpoints
A junction segment endpoint is any segment endpoint at an interior gap that ends at a gap intersection where other column rule or row rule segments are present. The row-rule-inset-junction-end property controls the inset of the end edge of row junction segments, allowing the segments to be shrunk or extended.
Length row-rule-inset-junction-end values inset junction segments by the specified value. Percentage values are relative to the size of the column-gap. Negative values create an outset, extending the end of the junction segment. Setting -50% outsets the end of the junction segment half way through the adjacent column gap, no matter how wide the column gap is.
In the following demonstration, the row rule segments in all but the last column end in junction endpoints. With row-rule-inset-junction-end: 16px set, the right, or end, of these segments is inset by 16px. Change the inset <length> value to better visualize which row segments end in junction segment endpoints.
The rule-break property is set to intersection, breaking all the row and column segments at every gap junction, with the end of each interior row segment abutting a column gap by default. The default value of the row-rule-inset-junction-end property is 0.
Change the inset value. Note how only the right ends of the row segments in the middle of the grid change when the property value changes. The segment endpoints at the containers do not change: these are cap endpoints, and are not affected by the row-rule-inset-junction-end property.
Select between as the rule-visibility-items value. This value causes rules in gap segments to be painted only if items occupy both adjacent areas. The row rule segment between 17 and 23 now ends at an interior junction where no other rule segments are present: the end of this row segment is a cap segment endpoint and isn't affected by the row-rule-inset-junction-end property. The row-rule-inset-cap-end property can be used to inset this segment endpoint.
The around value paints rules in gap segments if an item occupies at least one of the two adjacent areas. In this example, no junction segment endpoints became cap segment endpoints, but some cap segments were not drawn.
The overlap-join value
The overlap-join value outsets the end of interior segments so they align with the far edge of the intersected column-rule. The value resolves to half the column-gap size (extending it to the middle of the gap) plus half the column rule width. When row-rule-inset-junction-end is set to the overlap-join keyword value, the junction end segments extend into the column gap to meet, or "join", the opposite edge of the column rule painted in that gap.
In the following live example, row-rule-inset-junction-end is set to overlap-join:
Change the size of the column-rule-width and the column-gap. Notice how, no matter the size of the gap or column rule, the end of the row segment is always stretched across the column rule, with the endpoint aligned with the opposite edge of the column rule painted in the gap.
Formal definition
Value not found in DB!Formal syntax
row-rule-inset-junction-end =
<inset-value>
<inset-value> =
<length-percentage> |
overlap-join
<length-percentage> =
<length> |
<percentage>
Examples
>Basic usage
This example demonstrates setting row-rule-inset-junction-end to inset the end edge of row junction segments on flex containers.
HTML
The markup includes two <div> elements, each containing seven children. The only difference between the two containers is that the second one has an added column class.
<h1>Insetting junction row rule endpoints</h1>
<article>
<section>
<h2>flex-direction: row</h2>
<div class="flexbox">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</section>
<section>
<h2>flex-direction: column</h2>
<div class="flexbox column">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</section>
</article>
CSS
We use the display property to turn the .flexbox elements into flex containers. We balance the items into three flex lines using flex-wrap and flex-line-count. We define a light blue rule to paint both column and row gaps, then overwrite the row-rule-color, setting darker blue row gap decorations. Finally, we set the row-rule-inset-junction-end to 16px.
.flexbox {
display: flex;
flex-wrap: balance;
flex-line-count: 3;
gap: 20px;
rule: 5px solid lightblue;
row-rule-color: blue;
row-rule-inset-junction-end: 16px;
}
We also set the flex-direction on the .column container to column, changing the main axis of the flex container, making the items flow in columns rather than rows.
.column {
flex-direction: column;
}
The rest of the CSS is hidden for brevity.
Result
Change the size of the inset. Note that this property affects only row rules split into multiple segments. When a row rule is a single segment that spans the width of the container, the segment has two cap endpoints and no junction endpoints, and remains unaffected by changes to the row-rule-inset-junction-end value.
Specifications
| Specification |
|---|
| CSS Gaps Module Level 1> # propdef-row-rule-inset-junction-end> |
Browser compatibility
See also
row-rule-inset-junction-startrow-rule-inset-junctionshorthandrow-rule-insetshorthandrule-insetshorthandrow-rule-breakrule-breakshorthandrule-overlaprule-visibility-itemsruleshorthand- CSS gaps module