Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `row-rule`

The `row-rule` shorthand sets the `row-rule-width`, `row-rule-style`, and `row-rule-color` lists that paint decorative lines inside existing row gutters without creating a gap or changing layout geometry.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

<gap-rule-list> | <gap-auto-rule-list>

The row-rule shorthand sets the row-rule-width, row-rule-style, and row-rule-color lists that paint decorative lines inside existing row gutters without creating a gap or changing layout geometry.

The example combines row-rule:4px solid red with row-gap:20px; the second row still begins at 40, the grid remains 60 high, and the browser computes a red, 4-pixel, solid rule.

Grammar: <gap-rule-list> | <gap-auto-rule-list>.

A none style suppresses painting regardless of width. Lists and repeat() assign patterns across successive gutters, while row-rule-break, row-rule-inset, and row-rule-visibility-items control segment breaks, ends, and visibility; the rule changes neither the used gap nor track sizing.

Examples

<!doctype html><meta charset="utf-8"><style>html,body{margin:0}#grid{display:grid;grid-template-rows:20px 20px;row-gap:20px;row-rule:4px solid rgb(255,0,0);width:100px}#grid i{display:block}</style><div id="grid"><i></i><i id="second"></i></div><pre id="result"></pre><script>const s=getComputedStyle(grid),rowTop=Math.round(second.getBoundingClientRect().top-grid.getBoundingClientRect().top),height=Math.round(grid.getBoundingClientRect().height),values=[s.rowRuleWidth,s.rowRuleStyle,s.rowRuleColor];if(rowTop!==40||height!==60||values.join('/')!=='4px/solid/rgb(255, 0, 0)')throw new Error('row-rule mismatch '+[rowTop,height,values]);result.textContent='geometry='+rowTop+'/'+height+'; longhands='+values.join('/');</script>

Result

geometry=40/60; longhands=4px/solid/rgb(255, 0, 0)

The example combines `row-rule:4px solid red` with `row-gap:20px`; the second row still begins at 40, the grid remains 60 high, and the browser computes a red, 4-pixel, solid rule.

Sources