Rule - CSS Property
Summary of characteristics of the rule property
Per grammar: serialization in the order of syntax.Description of the rule property.
rule handles the divider lines between rows and columns in a grid container, flex-box, etc.
rule is a shorthand property that lets you set all the properties related to divider lines in a single rule, namely:
As well as the following summarized properties :
The dividing lines appear between rows or columns; there aren't any before the first row or column, nor after the last one. The space where these
lines sit is called the gap. It's managed by the row-gap, column-gap, and gap properties.
The dividing lines don't increase the size of this space, so they can overlap the content of the columns and/or rows, but in the background.
rule assigns the same values to the lines between rows and the lines between columns (this example doesn't work on all browsers).
Values for rule.
⚠ The examples don't work on (2026), or on other browsers either.
- rule: 3px solid blue;
If only one set of values is specified, all lines will be the same both in rows and columns. Like all the summarized properties,
ruleinitializes missing values to their default:mediumfor thickness,currentColorfor color, andnonefor line style. This last value is therefore necessary for the borders to appear.ABCDEFGHIJKLMNOPQRSTUVWXYZrule:3px solid blue; - rule: 3px solid blue, 5px double red; rule: repeat(2, 3px solid blue), 5px double red;
One or more groups of values separated by a comma. The
repeat()function is also allowed. Refer to its description for the exact syntax.The same values are applied to row borders and column borders. In the example below, we alternate blue and red borders. The thickness and line style also vary. We could alternate more values. If the number of gaps exceeds the number of values, the list starts over from the beginning.
ABCDEFGHIJKLMNOPQRSTUVWXYZrule:3px solid blue, 5px double red; - rule: initial; rule: inherit; rule: revert; rule: revert-layer; rule: revert-rule; rule: unset;
For more information, refer to the presentation pages of these different values:
initial,inherit,revert,revert-layer,revert-rule,unset.
Browsers compatibility with rule.
Refer to the pages on the different properties to see their compatibility. Overall, at the moment (2026), only and handle these properties reasonably well.
rule short-hand property that defines the settings for column separators and row separators in a flex container, grid, etc.ruleproperty
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Safari

Safari sur IOS

Opéra

Chrome

Edge

Firefox

Chrome pour Androïd

Samsung Internet

Androïd Brower

Firefox pour Androïd

KaiOS Browser

Opéra mini
Historic of the rule property.
-
CSS Gap Decorations Module Level 1.
This module covers the rules that define gutters between columns in a multi-column container (grid, flex-box...). It extends these possibilities to gutters between elements arranged in multiple rows, allowing these features to be used on other types of containers. Several properties define how these gutters should be drawn.
RegardingruleIntroduction of the concept of separation lines between the rows and columns of grids and flexboxes. And introduction of the properties to define them, includingrule.April 17, 2025Working Draft.
See also, about space decorations.
The property rule is described in the CSS Gap Decorations Module., but there are many other properties described in this module. Here's the list.



