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.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

border-right-color は CSS のプロパティで、要素の右側の境界線の色を設定します。一括指定プロパティの border-color または border-right でも設定することができます。

試してみましょう

border-right-color: red;
border-right-color: #32a1ce;
border-right-color: rgb(170, 50, 220, 0.6);
border-right-color: hsl(60, 90%, 50%, 0.8);
border-right-color: transparent;
<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: #000;
  border: 0.75em solid;
  padding: 0.75em;
  width: 80%;
  height: 100px;
}

構文

css
/* <color> 値 */
border-right-color: red;
border-right-color: #ffbb00;
border-right-color: rgb(255 0 0);
border-right-color: hsl(100deg 50% 25% / 75%);
border-right-color: currentcolor;
border-right-color: transparent;

/* グローバル値 */
border-right-color: inherit;
border-right-color: initial;
border-right-color: revert;
border-right-color: revert-layer;
border-right-color: unset;

border-right-color プロパティは 1 つの値で指定します。

<color>

右の境界線の色を定義します。

公式定義

初期値currentcolor
適用対象すべての要素。 ::first-letter にも適用されます。
継承なし
計算値色の計算値
アニメーションの種類

形式文法

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

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

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

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

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

境界線が付いた単純な div

HTML

html
<div class="my-box">
  <p>
    これは周囲に境界線があるボックスです。 なお、ボックスのその辺が<span class="red-text"></span>になっています。
  </p>
</div>

CSS

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

.red-text {
  color: red;
}

結果

仕様書

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

ブラウザーの互換性

関連情報