border-inline

CSS 属性 border-inline简写属性,用于在样式表中的某处同时设置逻辑行向边框的各属性值。

尝试一下

border-inline 所对应的实体边框取决于元素的书写模式、行内方向和文本朝向。根据 writing-modedirectiontext-orientation 所定义的值,此属性对应于 border-topborder-bottom,或者 border-rightborder-left 属性。

另一方向的边框可用 border-block 设置,此属性会设置 border-block-startborder-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

形式定义

初始值as each of the properties of the shorthand:
适用元素all elements
是否是继承属性
计算值as each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:

形式语法

border-inline = 
<'border-block-start'>

示例

竖排文本的边框

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

浏览器兼容性

BCD tables only load in the browser

参见