You are here: Reference > CSS > properties > border-color

border-color property

Browser support:
Specifies the color of the element's border.
The order of the color values: top, right, bottom, left.
JavaScript page for this property: borderColor. You can find other example(s) there.

Possible values:

 One of the following values: 
 Any of the following values (use the space character to separate them, each value can be used only 4 times): 
<color>
transparent
-moz-use-text-color
inherit

Description of values:

-moz-use-text-color
The color of the border should be the same as the text color.
color
Color of the border. For the supported color values, see the colors page.
inherit
Takes the value of this property from the computed style of the parent element.
transparent
Default. Underlying content will shine through.
Default: transparent.

  • If only one color value is set, it is used for all four borders.
  • If two color values are specified, the first value is used for the top and bottom borders, the second one is for the left and right borders.
  • If three color values are set, the first value is used for the top border, the second one is for the left and right borders and the third one is for the bottom border.
  • If four color values are specified, the order is top, right, bottom, left (clockwise from top).

Example HTML code 1:

This example illustrates the use of the border-color property:
<head>
    <style>
        .example {
            border-color: blue;
            border-width: 1px;
            border-style: solid;
        }
    </style>
</head>
<body>
    <div class="example">Border-color: blue</div>
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content