border-inline
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-inline: solid; writing-mode: horizontal-tb; border-inline: dashed red; writing-mode: vertical-rl; border-inline: 1rem solid; 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: #8b008b; padding: 0.75em; width: 80%; height: 100px; unicode-bidi: bidi-override; } border-inline 所对应的实体边框取决于元素的书写模式、行内方向和文本朝向。根据 writing-mode、direction 和 text-orientation 所定义的值,此属性对应于 border-top 和 border-bottom,或者 border-right 和 border-left 属性。
另一方向的边框可用 border-block 设置,此属性会设置 border-block-start 和 border-block-end。
属性构成
此属性为下列 CSS 属性的简写属性:
语法
css
border-inline: 1px; border-inline: 2px dotted; border-inline: medium dashed blue; /* 全局值 */ border-inline: inherit; border-inline: initial; border-inline: revert; border-inline: revert-layer; border-inline: unset; 取值
border-inline 属性可用下列值中的至少一个指定,次序任意:
<'border-width'>-
边框宽度。见
border-width。 <'border-style'>-
边框线型。见
border-style。 <'color'>-
边框颜色。见
color。
形式定义
| 初始值 | 该简写所对应的每个属性:
|
|---|---|
| 适用元素 | 所有元素 |
| 是否是继承属性 | 否 |
| 计算值 | 该简写所对应的每个属性:
|
| 动画类型 | 该简写所对应的每个属性:
|
形式语法
border-inline =
<'border-block-start'>
<border-block-start> =
<line-width> ||
<line-style> ||
<color>
<line-width> =
<length [0,∞]> |
thin |
medium |
thick
<line-style> =
none |
hidden |
dotted |
dashed |
solid |
double |
groove |
ridge |
inset |
outset
示例
>竖排文本的边框
HTML
html
<div> <p class="exampleText">示例文本</p> </div> CSS
css
div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; border-inline: 5px dashed blue; } 结果
规范
| Specification |
|---|
| CSS Logical Properties and Values Level 1> # propdef-border-inline> |