The CSS ‘border-color‘ property specifies the color of an element’s border. It can simultaneously set the color for all four borders or target each border individually with one to four color values. This property is essential for defining the visual boundaries of elements, enhancing usability, and contributing to the aesthetic appeal of web designs.
CSS ‘border-color’ Property Examples
See the Pen CSS ‘border-color’ Property by Webzstore (@webzstore) on CodePen.
The ‘background’ shorthand property offers a powerful and flexible way to style the background of elements. It supports a wide range of visual effects with concise syntax, making it essential for designers and developers who want to create engaging and visually rich web interfaces.
Browser Support For ‘border-color’ Property
![]() | ![]() | ![]() | ![]() | ![]() |
| 1.0 | 1.0 | 1.0 | 4.0 | 3.5 |
CSS Syntax of the ‘border-color’ Property
border-color: color | transparent | initial | inherit;
- When specifying one color, all four borders inherit this color.
- Two colors define the top and bottom borders with the first color and the right and left borders with the second.
- Three colors set the top border with the first color, the right and left with the second, and the bottom border with the third.
- Four colors apply to the borders of the top, right, bottom, and left.
Usage of the ‘border-color’ Property
Use ‘border-color‘ to customize the color of borders surrounding an element. This versatile property allows for uniform color application across all borders or specifies different colors for the top, right, bottom, and left borders. It’s particularly useful in distinguishing elements, improving visual hierarchy, or simply adding decorative flair to a webpage.
Property Values of the ‘border-color’ Property
- Color: Sets the border color using any standard CSS color format (named colors, HEX, RGB(a), HSL(a)).
- Transparent: Makes the border transparent.
- Initial: Resets the ‘border-color‘ to its default value.
- Inherit: The element inherits the ‘border-color‘ from its parent element.






Leave a Reply