--- title: border-right slug: Web/CSS/border-right tags: - CSS - CSS Borders - CSS Property - Reference - 'recipe:css-shorthand-property' translation_of: Web/CSS/border-right ---
border-right は一括指定の CSS のプロパティで、要素の右側の境界のプロパティをすべて設定します。
このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 https://github.com/mdn/interactive-examples をクローンしてプルリクエストを送信してください。
他の一括指定プロパティと同様に、 border-right は、一部の値が指定されていなくても、設定可能なプロパティをすべて設定します。指定されていないプロパティは既定値が設定されます。つまり・・・
border-right-style: dotted; border-right: thick green;
・・・は、実際には以下と同じです・・・
border-right-style: dotted; border-right: none thick green;
・・・そして、 border-right の前で設定された {{cssxref("border-right-style")}} の値は無視されます。 {{cssxref("border-right-style")}} の既定値は none なので、 border-style の部分の設定は境界線なしとなります。
このプロパティは以下の CSS プロパティの一括指定です。
border-right: 1px; border-right: 2px dotted; border-right: medium dashed green;
一括指定プロパティの3つの値は任意の順序で指定可能で、また、1つまたは2つの値を省略することができます。
<br-width><br-style>{{CSSInfo}}
<div> このボックスには右側に境界線があります。 </div>
div {
border-right: 4px dashed blue;
background-color: gold;
height: 100px;
width: 100px;
font-weight: bold;
text-align: center;
}
{{EmbedLiveSample('Applying_a_right_border')}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS3 Backgrounds', '#propdef-border-right', 'border-right')}} | {{Spec2('CSS3 Backgrounds')}} | 直接的な変更はないが、 {{cssxref("border-right-color")}} に適用される値が変更された。 |
| {{SpecName('CSS2.1', 'box.html#propdef-border-right', 'border-right')}} | {{Spec2('CSS2.1')}} | 有意な変更点なし。 |
| {{SpecName('CSS1', '#border-right', 'border-right')}} | {{Spec2('CSS1')}} | 初回定義 |
{{Compat("css.properties.border-right")}}