border-bottom-color

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

概述

border-bottom-color 属性设置一个元素底部边框的颜色。应当指出,在多数情况下,CSS 简写属性 border-colorborder-bottom 更方便实用。

初始值currentcolor
适用元素所有元素. It also applies to ::first-letter.
是否是继承属性
计算值颜色计算值
动画类型a color

语法

css
border-bottom-color: yellow;
border-bottom-color: #f5f6f7;

<color>

一个描绘底边的颜色的 CSS <color> 值。

inherit

一个代表父元素底边颜色的关键字(可能和 border-bottom-color 默认值不同)

正式语法

border-bottom-color = 
<color> |
<image-1D>

<image-1D> =
<stripes()>

<stripes()> =
stripes( <color-stripe># )

<color-stripe> =
<color> &&
[ <length-percentage> | <flex> ]?

<length-percentage> =
<length> |
<percentage>

示例

一个带有边框的简单 div

HTML 内容

html
<div class="mybox">
  <p>
    This is a box with a border around it. Note which side of the box is
    <span class="redtext">red</span>.
  </p>
</div>

CSS 内容

css
.mybox {
  border: solid 0.3em gold;
  border-bottom-color: red;
  width: auto;
}

.redtext {
  color: red;
}

结果

规范

Specification
CSS Backgrounds and Borders Module Level 3
# border-color

浏览器兼容性

BCD tables only load in the browser

参见