border-inline-style

Baseline 已廣泛支援

此特性已得到良好支援,可在多種裝置和瀏覽器版本上使用。自 2021 年 4 月起,所有瀏覽器均已支援此特性。

border-inline-style CSS 屬性定義了一個元素的邏輯行內邊框的樣式,它會根據元素的書寫模式(writing mode)、方向性(directionality)和文字方向(text orientation)對映到物理邊框樣式。它對應於 border-top-styleborder-bottom-style,或者 border-left-styleborder-right-style 屬性,具體取決於為 writing-modedirectiontext-orientation 定義的值。

試一試

border-inline-style: dotted;
writing-mode: horizontal-tb;
border-inline-style: dotted;
writing-mode: vertical-rl;
border-inline-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: #eeeeee;
  color: black;
  border: 0.75em solid;
  padding: 0.75em;
  width: 80%;
  height: 100px;
  unicode-bidi: bidi-override;
}

另一個維度上的邊框樣式可以透過 border-block-style 設定,它會設定 border-block-start-styleborder-block-end-style

語法

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

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

<'border-style'>

邊框的線條樣式。請參閱 border-style

正式定義

初始值none
應用於所有元素
繼承性
計算值同指定值
動畫型別離散

正式語法

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

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

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

示例

設定 border-inline-style

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-inline-style: dashed;
}

規範

規範
CSS 邏輯屬性和值第 1 級
# propdef-border-inline-style

瀏覽器相容性

另見