border-right-color

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

border-right-color 是一種 CSS 屬性,用來設定元件右側邊框的顏色。也可由含括此屬性功能的簡寫屬性 border-colorborder-right 設定該屬性值。

嘗試一下

語法

css
/* <color> values */
border-right-color: red;
border-right-color: #ffbb00;
border-right-color: rgb(255, 0, 0);
border-right-color: hsla(100%, 50%, 25%, 0.75);
border-right-color: currentcolor;
border-right-color: transparent;

/* Global values */
border-right-color: inherit;
border-right-color: initial;
border-right-color: revert;
border-right-color: revert-layer;
border-right-color: unset;

border-right-color只能宣告一個屬性值。

屬性值

<color>

定義右側邊框色彩。

Formal definition 標準定義

預設值currentcolor
Applies toall elements. It also applies to ::first-letter.
繼承與否no
Computed valuecomputed color
Animation typea color

Formal syntax 語法規則

border-right-color = 
<color> |
<image-1D>

<image-1D> =
<stripes()>

<stripes()> =
stripes( <color-stripe># )

<color-stripe> =
<color> &&
[ <length-percentage> | <flex> ]?

<length-percentage> =
<length> |
<percentage>

範例

簡易邊框範例

HTML

html
<div class="mybox">
  <p>
    這是一個帶有框線的方框。 請注意某側框線顏色已設為
    <span class="redtext">紅色</span>。
  </p>
</div>

CSS

css
.mybox {
  border: solid 0.3em gold;
  border-right-color: red;
  width: auto;
}

.redtext {
  color: red;
}

成果

規範

Specification
CSS Backgrounds and Borders Module Level 3
# border-color

瀏覽器相容性

BCD tables only load in the browser

參見