border-bottom
試してみましょう
他の一括指定プロパティと同様に、 border-bottom
は、一部の値が指定されていなくても、設定可能なプロパティをすべて設定します。指定されていないプロパティは既定値が設定されます。つまり・・・
border-bottom-style: dotted;
border-bottom: thick green;
・・・は、実際には以下と同じです・・・
border-bottom-style: dotted;
border-bottom: none thick green;
・・・そして、 border-bottom
の前で設定された border-bottom-style
の値は無視されます。 border-bottom-style
の既定値は none
なので、 border-style
の部分の設定は境界線なしとなります。
構成要素のプロパティ
このプロパティは以下の CSS プロパティの一括指定です。
構文
border-bottom: 1px;
border-bottom: 2px dotted;
border-bottom: medium dashed blue;
/* グローバル値 */
border-bottom: inherit;
border-bottom: initial;
border-bottom: revert;
border-bottom: unset;
一括指定プロパティの 3 つの値は任意の順序で指定可能で、また、 1 つまたは 2 つの値を省略することができます。
値
<br-width>
-
border-bottom-width
を参照してください。 <br-style>
-
border-bottom-style
を参照してください。 <color>
-
border-bottom-color
を参照してください。
公式定義
初期値 | 一括指定の次の各プロパティとして
|
---|---|
適用対象 | すべての要素。 ::first-letter にも適用されます。 |
継承 | なし |
計算値 | 一括指定の次の各プロパティとして
|
アニメーションの種類 | 一括指定の次の各プロパティとして |
形式文法
<line-width> || <line-style> || <color>ここで
<line-width> = <length> | thin | medium | thick
<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>ここで
<rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )
<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )
<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )
<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )
<hwb()> = hwb( [<hue> | none] [<percentage> | none] [<percentage> | none] [ / [<alpha-value> | none] ]? )ここで
<alpha-value> = <number> | <percentage>
<hue> = <number> | <angle>
例
下の境界の適用
HTML
<div>
このボックスには下側に境界線があります。
</div>
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 4 # border-shorthands |
ブラウザーの互換性
BCD tables only load in the browser