CSS-底部边框 | 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的值因此被忽略了.

由于border-bottom-style并没有默认值, 未被定义的 border-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 type

as 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  

语法

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

 border-bottom-width. border-bottom-style. 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;
}

规范

Specification

Status

Comment

CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom' in that specification.

Candidate Recommendation

No 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.

Recommendation

No significant changes.

CSS Level 1The definition of 'border-bottom' in that specification.

Recommendation

Initial definition.

浏览器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari (WebKit)

Basic support

1.0

(Yes)

1.0 (1.7 or earlier)

4

3.5

1.0 (85)

Feature

Android

Edge

Firefox Mobile (Gecko)

IE Phone

Opera Mobile

Safari Mobile

Basic support

1.0

(Yes)

1.0 (1.0)

(Yes)

(Yes)

(Yes)

你可能感兴趣的:(CSS-底部边框 | border-bottom)