border-block-style

Baseline Widely available

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

Die border-block-style CSS Eigenschaft definiert den Stil der logischen Blockränder eines Elements, was je nach Schreibrichtung, Richtung und Textausrichtung des Elements einem physischen Randstil entspricht. Sie entspricht den Eigenschaften border-top-style und border-bottom-style, oder border-left-style und border-right-style, abhängig von den für writing-mode, direction und text-orientation definierten Werten.

Probieren Sie es aus

border-block-style: dotted;
writing-mode: horizontal-tb;
border-block-style: dotted;
writing-mode: vertical-rl;
border-block-style: groove;
writing-mode: horizontal-tb;
direction: rtl;
<section class="default-example" id="default-example">
  <div class="transition-all" id="example-element">
    This is a box with a border around it.
  </div>
</section>
#example-element {
  background-color: #eee;
  color: #000;
  border: 0.75em solid;
  padding: 0.75em;
  width: 80%;
  height: 100px;
  unicode-bidi: bidi-override;
}

Der Randstil in der anderen Dimension kann mit border-inline-style gesetzt werden, welches border-inline-start-style und border-inline-end-style setzt.

Syntax

css
/* <'border-style'> values */
border-block-style: dashed;
border-block-style: dotted;
border-block-style: groove;

/* Global values */
border-block-style: inherit;
border-block-style: initial;
border-block-style: revert;
border-block-style: revert-layer;
border-block-style: unset;

Werte

<'border-style'>

Der Linienstil des Randes. Siehe border-style.

Formale Definition

Anfangswertnone
Anwendbar aufalle Elemente
VererbtNein
Berechneter Wertwie angegeben
Animationstypdiskret

Formale Syntax

border-block-style = 
<'border-top-style'>{1,2}

<border-top-style> =
<line-style>

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

Beispiele

Gepunkteter Rand mit vertikalem Text

HTML

html
<div>
  <p class="exampleText">Example text</p>
</div>

CSS

css
div {
  background-color: yellow;
  width: 120px;
  height: 120px;
}

.exampleText {
  writing-mode: vertical-lr;
  border: 5px solid blue;
  border-block-style: dashed;
}

Ergebnisse

Spezifikationen

Specification
CSS Logical Properties and Values Level 1
# propdef-border-block-style

Browser-Kompatibilität

BCD tables only load in the browser

Siehe auch