Back to Content

column-rule

files/en-us/web/css/reference/properties/column-rule/index.md

latest3.1 KB
Original Source

The column-rule shorthand CSS property sets the width, style, and color of the line drawn between columns in a multi-column layout.

{{InteractiveExample("CSS Demo: column-rule")}}

css
column-rule: dotted;
css
column-rule: solid 6px;
css
column-rule: solid blue;
css
column-rule: thick inset blue;
html
<section id="default-example">
  <p id="example-element">
    London. Michaelmas term lately over, and the Lord Chancellor sitting in
    Lincoln's Inn Hall. Implacable November weather. As much mud in the streets
    as if the waters had but newly retired from the face of the earth, and it
    would not be wonderful to meet a Megalosaurus, forty feet long or so,
    waddling like an elephantine lizard up Holborn Hill.
  </p>
</section>
css
#example-element {
  columns: 3;
  column-rule: solid;
  text-align: left;
}

Constituent properties

This property is a shorthand for the following CSS properties:

  • {{Cssxref("column-rule-color")}}
  • {{Cssxref("column-rule-style")}}
  • {{Cssxref("column-rule-width")}}

Syntax

css
column-rule: dotted;
column-rule: solid 8px;
column-rule: solid blue;
column-rule: thick inset blue;

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

Values

The column-rule property is specified as one, two, or three of the values listed below, in any order.

  • <'column-rule-width'>
    • : Is a {{cssxref("<length>")}} or one of the three keywords, thin, medium, or thick. See {{cssxref("border-width")}} for details.
  • <'column-rule-style'>
    • : See {{cssxref("border-style")}} for possible values and details.
  • <'column-rule-color'>
    • : Is a {{cssxref("<color>")}} value.

Formal definition

{{cssinfo}}

Formal syntax

{{csssyntax}}

Examples

Example 1

css
/* Same as "medium dotted currentColor" */
p.foo {
  column-rule: dotted;
}

/* Same as "medium solid blue" */
p.bar {
  column-rule: solid blue;
}

/* Same as "8px solid currentColor" */
p.baz {
  column-rule: solid 8px;
}

p.abc {
  column-rule: thick inset blue;
}

Example 2

HTML

html
<p class="content-box">
  This is a bunch of text split into three columns. Take note of how the
  `column-rule` property is used to adjust the style, width, and color of the
  rule that appears between the columns.
</p>

CSS

css
.content-box {
  padding: 0.3em;
  background: #ffff77;
  column-count: 3;
  column-rule: inset 2px #3333ff;
}

Result

{{EmbedLiveSample('Example_2')}}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also