rule-overlap 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 rule-overlap CSS property specifies which rule is painted on top when column rules and row rules intersect.

Try it

rule-overlap: row-over-column;
rule-overlap: column-over-row;
<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);
  row-rule: solid thick orange;
  column-rule: solid thick purple;
}
#example-element i {
  padding: 5px;
}

Syntax

css
/* Keywords */
rule-overlap: row-over-column;
rule-overlap: column-over-row;

/* Global values */
rule-overlap: inherit;
rule-overlap: initial;
rule-overlap: revert;
rule-overlap: revert-layer;
rule-overlap: unset;

Values

This property is specified as a single keyword from the following list:

row-over-column

Specifies that row rules are painted over column rules. This is the default value.

column-over-row

Specifies that column rules are painted over row rules.

Formal definition

Value not found in DB!

Formal syntax

rule-overlap = 
row-over-column |
column-over-row

Examples

Basic usage

In this example, we use the rule-overlap property to paint column rules on top of row rules.

HTML

We create a list of 75 items. Most of the HTML is hidden for brevity.

html
<ul>
  <li>1</li>
  <li>2</li>
  ...
  <li>74</li>
  <li>75</li>
</ul>

CSS

We define the unordered list as a 10-column grid container using the grid-template-columns property. We set list-style-type to an empty string to remove the bullets. We include a gap of 20px to provide enough room between the columns and rows to fit our 20px solid column and row rules. Finally, we use the rule-overlap property to draw the column rules on top of the row rules.

css
ul {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  list-style-type: "";
  gap: 20px;

  row-rule: 20px solid palegoldenrod;
  column-rule: 20px solid olive;

  rule-overlap: column-over-row;
}

The rest of the CSS has been hidden for brevity.

Result

Select the checkbox to toggle the value of the rule-overlap property.

Specifications

Specification
CSS Gaps Module Level 1
# propdef-rule-overlap

Browser compatibility

See also