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  

语法

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

<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;
}

规范

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)

相关文章
|
1月前
|
前端开发
CSS——通过伪类来自定义四个角边框
CSS——通过伪类来自定义四个角边框
51 3
|
3月前
|
前端开发
CSS中的边框属性:border、border-width、border-color、border-style 详解
CSS中的边框属性:border、border-width、border-color、border-style 详解
173 44
|
29天前
|
前端开发
边框也疯狂:CSS创造令人瞩目的流光闪烁效果!
边框也疯狂:CSS创造令人瞩目的流光闪烁效果!
|
29天前
|
前端开发 容器
边框线条的魔法:CSS动画效果,让网页设计流动起来!
边框线条的魔法:CSS动画效果,让网页设计流动起来!
|
3月前
|
前端开发
css动画效果(边框流光闪烁阴影效果)
css动画效果(边框流光闪烁阴影效果)
|
3月前
|
前端开发 容器
css动画效果(边框线条流动效果)
css动画效果(边框线条流动效果)
|
3月前
|
前端开发 容器
CSS3 新增背景属性 + 新增边框属性(如果想知道CSS3新增背景属性和新增边框属性的知识点,那么只看这一篇就够了!)
CSS3 新增背景属性 + 新增边框属性(如果想知道CSS3新增背景属性和新增边框属性的知识点,那么只看这一篇就够了!)
|
3月前
|
前端开发
CSS基础-盒模型:边框、内边距、外边距
【6月更文挑战第8天】Web设计中的盒模型由内容区域、内边距、边框和外边距组成,是理解页面布局的关键。内容区域包含实际内容,内边距提供间隔,边框定义元素边界,外边距控制元素间距。常见易错点包括边框宽度计算、外边距折叠和盒模型理解不透彻。通过实践和媒体查询可解决响应式设计挑战,`border-radius`可能导致圆角问题。理解盒模型并灵活应用能创建多样化布局。
47 6
|
2月前
|
前端开发
前端 CSS 经典:旋转边框效果
前端 CSS 经典:旋转边框效果
26 0
|
2月前
|
前端开发 API 开发者
前端 CSS 经典:边框转圈动画效果
前端 CSS 经典:边框转圈动画效果
114 0