border-bottom

border-bottom一括指定CSS のプロパティで、要素の下側の境界のプロパティをすべて設定します。

試してみましょう

他の一括指定プロパティと同様に、 border-bottom は、一部の値が指定されていなくても、設定可能なプロパティをすべて設定します。指定されていないプロパティは既定値が設定されます。次のコードを考えてください。

css
border-bottom-style: dotted;
border-bottom: thick green;

これは、実際には以下と同じです。

css
border-bottom-style: dotted;
border-bottom: none thick green;

border-bottom の前で設定された border-bottom-style の値は無視されます。 border-bottom-style の既定値は none なので、 border-style の部分の設定は境界線なしとなります。

構成要素のプロパティ

このプロパティは以下の CSS プロパティの一括指定です。

構文

css
border-bottom: 1px;
border-bottom: 2px dotted;
border-bottom: medium dashed blue;

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

一括指定プロパティの 3 つの値は任意の順序で指定可能で、また、 1 つまたは 2 つの値を省略することができます。

<br-width>

border-bottom-width を参照してください。

<br-style>

border-bottom-style を参照してください。

<color>

border-bottom-color を参照してください。

公式定義

初期値一括指定の次の各プロパティとして
適用対象すべての要素。 ::first-letter にも適用されます。
継承なし
計算値一括指定の次の各プロパティとして
アニメーションの種類一括指定の次の各プロパティとして

形式文法

border-bottom = 
<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>このボックスには下側に境界線があります。</div>

CSS

css
div {
  border-bottom: 4px dashed blue;
  background-color: gold;
  height: 100px;
  width: 100px;
  font-weight: bold;
  text-align: center;
}

結果

仕様書

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

ブラウザーの互換性

BCD tables only load in the browser

関連情報