column-rule

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

Die column-rule Kurzform CSS-Eigenschaft setzt die Breite, den Stil und die Farbe der Linie, die zwischen Spalten in einem Mehrspalten-Layout gezogen wird.

Probieren Sie es aus

Bestandteileigenschaften

Diese Eigenschaft ist eine Kurzform für die folgenden CSS-Eigenschaften:

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;

Werte

Die column-rule-Eigenschaft wird als einer, zwei oder drei der unten aufgeführten Werte in beliebiger Reihenfolge angegeben.

<'column-rule-width'>

Ist eine <length> oder eines der drei Schlüsselwörter, thin, medium oder thick. Siehe border-width für Details.

<'column-rule-style'>

Siehe border-style für mögliche Werte und Details.

<'column-rule-color'>

Ist ein <color>-Wert.

Formale Definition

Anfangswertwie die jeweiligen Kurzschreibweisen:
Anwendbar aufmehrspaltige Elemente
VererbtNein
Berechneter Wertwie die jeweiligen Kurzschreibweisen:
Animationstypwie die jeweiligen Kurzschreibweisen:

Formale Syntax

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

<gap-rule-list> =
<gap-rule-or-repeat> [ / <gap-rule-or-repeat> ]*

<auto-gap-rule-list> =
[ [ <gap-rule-or-repeat> ] / ]* <auto-repeat-gap-rule> [ / [ <gap-rule-or-repeat> ] ]*

<gap-rule-or-repeat> =
<gap-rule> |
<repeat-gap-rule>

<auto-repeat-gap-rule> =
repeat( auto , [ <gap-rule> ]# )

<gap-rule> =
<line-width> ||
<line-style> ||
<color>

<repeat-gap-rule> =
repeat( [ <integer [1,∞]> ] , [ <gap-rule> ]# )

<line-width> =
<length [0,∞]> |
thin |
medium |
thick

<line-style> =
none |
hidden |
dotted |
dashed |
solid |
double |
groove |
ridge |
inset |
outset

Beispiele

Beispiel 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;
}

Beispiel 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: #ff7;
  column-count: 3;
  column-rule: inset 2px #33f;
}

Ergebnis

Spezifikationen

Specification
CSS Multi-column Layout Module Level 1
# column-rule

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
column-rule

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

Siehe auch