border-block-style

The border-block-style CSS property defines the style of the logical block borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation.

尝试一下

The border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style.

语法

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;

<'border-style'>

边框的线型。请参见 border-style.

正式定义

初始值none
应用于所有元素
继承no
计算值如指定
动画类型离散

正式语法

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

结果

规范

规范
CSS 逻辑属性和值级别 1
# propdef-border-block-style

浏览器兼容性

BCD 表格仅在浏览器中加载

另请参阅