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