border-left-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-left-color 是一種 CSS 屬性,用來設定元件左側邊框的顏色。也可由含括此屬性功能的簡寫屬性 border-colorborder-left 設定該屬性值。

嘗試一下

語法

css
/* <color> values */
border-left-color: red;
border-left-color: #ffbb00;
border-left-color: rgb(255, 0, 0);
border-left-color: hsla(100%, 50%, 25%, 0.75);
border-left-color: currentcolor;
border-left-color: transparent;

/* Global values */
border-left-color: inherit;
border-left-color: initial;
border-left-color: revert;
border-left-color: revert-layer;
border-left-color: unset;

border-left-color只能宣告一個屬性值。

屬性值

<color>

定義左側邊框色彩。

Formal definition 標準定義

預設值currentcolor
Applies toall elements. It also applies to ::first-letter.
繼承與否no
Computed valuecomputed color
Animation typea color

Formal syntax 語法規則

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

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

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

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

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

範例

簡易邊框範例

HTML

html
<div class="mybox">
  <p>
    這是一個帶有框線的方框。 請注意某側框線顏色已設為
    <span class="redtext">紅色</span></p>
</div>

CSS

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

.redtext {
  color: red;
}

成果

規範

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

瀏覽器相容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
border-left-color

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

參見