在线文档教程
CSS
背景和边框 | Backgrounds & Borders

底部边框 | border-bottom

border-bottom

border-bottom 简写属性把下边框的所有属性:border-bottom-colorborder-bottom-style 与 border-bottom-width设置到了一个声明中。这些属性描述了元素的下边框样式。

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

与所有的简记属性相同, border-bottom 定义了它所有可以定义的属性,即使他们并没有被显式地定义。它把所有未被显式定义的参数都设置为了默认值,这意味着这些值将被定义为:

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

它和以下的代码是等价的:

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

顺便一提,在 border-bottom 之前定义的border-bottom-style的值因此被忽略了.

初始值as each of the properties of the shorthand: border-bottom-width: medium border-bottom-style: none border-bottom-color: currentcolor
适用元素all elements. It also applies to ::first-letter.
是否是继承属性no
适用媒体visual
计算值as each of the properties of the shorthand: border-bottom-width: the absolute length or 0 if border-bottom-style is none or hidden border-bottom-style: as specified border-bottom-color: computed color
Animation typeas each of the properties of the shorthand: border-bottom-color: a color border-bottom-style: discrete border-bottom-width: a length
正规顺序order of appearance in the formal grammar of the values

  • border-bottom-widthmedium

  • border-bottom-stylenone

  • border-bottom-colorcurrentcolor

Applies to all elements. It also applies to [`::first-letter`](::first-letter). [Inherited](inheritance) no Media visual [Computed value](computed_value) as each of the properties of the shorthand:

  • border-bottom-width:绝对长度或0如果border-bottom-stylenonehidden

  • border-bottom-style:具体规定

  • border-bottom-color:计算颜色

Animation type as each of the properties of the shorthand:

  • border-bottom-color:颜色

  • border-bottom-style:离散

  • border-bottom-width:长度

Canonical order order of appearance in the formal grammar of the values

语法

速记属性的三个值可以按任意顺序指定,其中一个或两个可以省略。

<br-width> 见border-bottom-width.<br-style> 见border-bottom-style.<color> 见border-bottom-color.

正式语法

<br-width> || <br-style> || <color>where <br-width> = <length> | thin | medium | thick <br-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color> where <rgb()> = rgb( [ [ <percentage>{3} | <number>{3} ] [ / <alpha-value> ]? ] | [ [ <percentage>#{3} | <number>#{3} ] , <alpha-value>? ] ) <rgba()> = rgba( [ [ <percentage>{3} | <number>{3} ] [ / <alpha-value> ]? ] | [ [ <percentage>#{3} | <number>#{3} ] , <alpha-value>? ] ) <hsl()> = hsl( [ <hue> <percentage> <percentage> [ / <alpha-value> ]? ] | [ <hue>, <percentage>, <percentage>, <alpha-value>? ] ) <hsla()> = hsla( [ <hue> <percentage> <percentage> [ / <alpha-value> ]? ] | [ <hue>, <percentage>, <percentage>, <alpha-value>? ] ) where <alpha-value> = <number> | <percentage> <hue> = <number> | <angle>

示例

<div> This box has a border on the bottom side. </div>

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

规范

SpecificationStatusComment
CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom' in that specification.Candidate RecommendationNo direct changes, though the modification of values for the border-bottom-color do apply to it.
CSS Level 2 (Revision 1)The definition of 'border-bottom' in that specification.RecommendationNo significant changes.
CSS Level 1The definition of 'border-bottom' in that specification.RecommendationInitial definition.

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0(Yes)1.0 (1.7 or earlier)43.51.0 (85)

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support1.0(Yes)1.0 (1.0)(Yes)(Yes)(Yes)