border-inline
试一试
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: #eeeeee;
  color: darkmagenta;
  padding: 0.75em;
  width: 80%;
  height: 100px;
  unicode-bidi: bidi-override;
}
border-inline 映射到的物理边框取决于元素的书写模式、方向性和文本方向。它对应于 border-top 和 border-bottom 或 border-right 和 border-left 属性,具体取决于为 writing-mode、direction 和 text-orientation 定义的值。
另一个维度上的边框可以使用 border-block 进行设置,它会设置 border-block-start 和 border-block-end。
构成属性
此属性是以下 CSS 属性的简写:
语法
css
border-inline: 1px;
border-inline: 2px dotted;
border-inline: medium dashed blue;
/* Global values */
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>
- 
边框的颜色。 
正式定义
| 初始值 | 作为简写中的每个属性 
 | 
|---|---|
| 应用于 | 所有元素 | 
| 继承性 | 否 | 
| 计算值 | 作为简写中的每个属性 
 | 
| 动画类型 | 作为简写中的每个属性 
 | 
正式语法
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">Example text</p>
</div>
CSS
css
div {
  background-color: yellow;
  width: 120px;
  height: 120px;
}
.exampleText {
  writing-mode: vertical-rl;
  border-inline: 5px dashed blue;
}
结果
规范
| 规范 | 
|---|
| CSS 逻辑属性和值第 1 级 # propdef-border-inline | 
浏览器兼容性
加载中…
另见
- CSS 逻辑属性与值
- 此属性映射到以下物理边框属性之一:border-top、border-right、border-bottom或border-left。
- writing-mode、- direction、- text-orientation