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

浏览器兼容性

另见