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 2021年4月.
border-block-style は CSS のプロパティで、要素の論理的なブロック方向の境界のスタイルを定義し、それが要素の書字方向やテキストの方向に応じて物理的な境界のスタイルに対応づけられます。これは border-top-style と border-bottom-style、または border-left-style と border-right-style のどちらかに対応し、どちらに対応するかは writing-mode, direction, text-orientation で定義された値によって決まります。
試してみましょう
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; } 他の方向の境界については、 border-inline-style によって、 border-inline-start-style と border-inline-end-style の両方を設定することができます。
構文
css
/* <'border-style'> 値 */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; /* グローバル値 */ border-block-style: inherit; border-block-style: initial; border-block-style: revert; border-block-style: unset; 値
<'border-style'>-
境界のスタイルです。
border-styleを参照してください。
公式定義
| 初期値 | none |
|---|---|
| 適用対象 | すべての要素 |
| 継承 | なし |
| 計算値 | 指定通り |
| アニメーションの種類 | 離散値 |
形式文法
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
例
>縦書きでの破線の境界
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; } 結果
仕様書
| Specification |
|---|
| CSS Logical Properties and Values Level 1> # propdef-border-block-style> |
ブラウザーの互換性
関連情報
- このプロパティは
border-top-style,border-right-style,border-bottom-style,border-left-styleのうちの 1 つに対応します writing-mode,direction,text-orientation