Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. border-color

border-color

Sets the border colors for all sides at once.

You can specify different colors for each side by providing multiple values separated by spaces.

  • 1 value: applied to all four sides (top, right, bottom, left).
  • 2 values: first applies to top and bottom, second to left and right.
  • 3 values: first applies to top, second to left and right, third to bottom.
  • 4 values: applied to top, right, bottom, and left (clockwise from top).

Sample Code

style.css
/* Applies to all four sides. */
div.test { border-color: red;}

/* Applies to top/bottom and left/right. */
div.test1 { border-color: red #ff0;}

/* Applies to top, left/right, and bottom. */
div.test2 { border-color: red #ff0 #00f;}

/* Applies to top, right, bottom, and left. */
div.test3 { border-color: red #ff0 #00f black;}

Available Values

ValueDescription
transparentSets the border to transparent.
Color code or color nameChanges the border to the specified color. If no『border-color』value is set, the color of the『color』property is used as the default.

Browser Preview

※ The samples below use『border-style: solid』.

<div style="border-color: red; border-style: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border-color: red #ff0; border-style: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border-color: red #ff0 #00f; border-style: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border-color: red #ff0 #00f black; border-style: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

Notes

Sets the border colors for all sides at once.

If no value is set for『border-color』, the color of the『color』property is used as the default.

Browser Compatibility

Chrome Chrome
1+
Firefox Firefox
1+
Safari Safari
1+
Edge Edge
12+
IE IE
11
10
9
8
7
6
Opera Opera
3.5+
2 and below ×
iOS Safari iOS Safari
1+
Android Android Browser
4+
3 and below ×
Chrome Android Chrome Android
Latest
Same support as desktop version
Firefox Android Firefox Android
Latest
Same support as desktop version

※ Version information is based on MDN.

If you find any errors or copyright issues, please .