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)

相关文章
|
22天前
|
前端开发
css解决li边框重合问题
css解决li边框重合问题
25 0
|
22天前
|
前端开发
css实现伪类三角形气泡框 带边框
css实现伪类三角形气泡框 带边框
35 3
|
22天前
|
前端开发
|
8月前
|
前端开发
CSS新增样式----圆角边框、盒子阴影、文字阴影
CSS新增样式----圆角边框、盒子阴影、文字阴影
|
17天前
|
前端开发
前端 CSS 经典:弧形边框选项卡
前端 CSS 经典:弧形边框选项卡
25 0
|
18天前
|
前端开发
CSS边框
CSS边框。
20 1
|
22天前
|
前端开发
实践任务:项目介绍与项目准备+制作网页头部和导航+制作banner和最新更新栏目+制作苹果之家栏目+制作底部版权区域与CSS代码优化+制作Apple独家栏目
实践任务:项目介绍与项目准备+制作网页头部和导航+制作banner和最新更新栏目+制作苹果之家栏目+制作底部版权区域与CSS代码优化+制作Apple独家栏目
12 1
|
22天前
|
前端开发
CSS边框
【5月更文挑战第4天】CSS边框。
24 2
|
22天前
|
前端开发 UED
【专栏:CSS基础篇】CSS背景与边框:设计网页外观
【4月更文挑战第30天】CSS中的背景和边框是网页设计的关键元素,能增强视觉层次和用户体验。背景可通过`background-color`设置颜色,`background-image`添加图像,`background-position`和`background-size`调整位置和大小。边框用`border-style`定义样式,`border-width`设定宽度,`border-radius`创建圆角。理解并巧妙运用这些属性,结合媒体查询实现响应式设计,将使网页更具吸引力和功能性。不断学习和创新是提升设计能力的关键。
|
22天前
|
前端开发 开发者
CSS3的常见边框汇总
CSS3的常见边框汇总
16 2