border-block-color
border-block-color CSS 属性定义了元素逻辑块边框的颜色,根据元素的书写模式、方向性和文本方向,它映射到物理边框颜色。它对应于 border-top-color 和 border-bottom-color,或者 border-right-color 和 border-left-color 属性,具体取决于为 writing-mode、direction 和 text-orientation 定义的值。
试一试
border-block-color: red;
writing-mode: horizontal-tb;
border-block-color: #32a1ce;
writing-mode: vertical-rl;
border-block-color: rgb(170 50 220 / 0.6);
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-inline-color 设置,它设置了 border-inline-start-color 和 border-inline-end-color。
语法
css
border-block-color: yellow;
border-block-color: #f5f6f7;
/* Global values */
border-block-color: inherit;
border-block-color: initial;
border-block-color: revert;
border-block-color: revert-layer;
border-block-color: unset;
值
<color>-
边框的颜色。
正式定义
正式语法
border-block-color =
<'border-top-color'>{1,2}
<border-top-color> =
<color> |
<image-1D>
<image-1D> =
<stripes()>
<stripes()> =
stripes( <color-stripe># )
<color-stripe> =
<color> &&
[ <length-percentage> | <flex> ]?
<length-percentage> =
<length> |
<percentage>
示例
垂直文本的边框
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: 10px solid blue;
border-block-color: red;
}
结果
规范
| 规范 |
|---|
| CSS 逻辑属性和值第 1 级 # propdef-border-block-color |
浏览器兼容性
加载中…