border-color

Sets the border color of the object.

Syntax

{ border-color: sColor }

Possible values

sColor

String that specifies or receives one or more of the following space-delimited values:

color

Up to four color names or RGB values.

transparent

Border is transparent.

This property has no default value and is not inherited.

Remarks

You can specify up to four different colors in the following order: top, right, bottom, left. If one color is supplied, it is used for all four sides. If two colors are supplied, the first is used for the top and bottom, and the second is used for left and right. If three colors are supplied, they are used for top, right/left, and bottom, respectively.

The border-color property does not render if the border-style property is set to none.

Some browsers do not recognize color names, but all browsers should recognize RGB color values and display them correctly.

Examples

The following example uses the border-color property to specify the border color. This example uses a call to an embedded (global) style sheet to change the color of the border to blue from an initial value of red when the pointer hovers over the image:

<head><style>
    td { border-color: red; border-width: 0.5cm; }
    .blue  { border-color: blue; }
</style>
</head>
<body>
<table border >
<tr>
    <td onmouseover="this.className='blue'" onmouseout="this.className=''">
        <img src="sphere.jpg">
    </td>
</tr>
</table>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371301.xtlink_newWindow(en-us,Expression.40).png.

Applies to

A, ABBR, ACRONYM, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, CUSTOM, DD, DEFAULTS, DEL, DFN, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, HN, HR, I, IFRAME, IMG, INPUT TYPE=BUTTON, INPUT TYPE=CHECKBOX, INPUT TYPE=FILE, INPUT TYPE=IMAGE, INPUT TYPE=PASSWORD, INPUT TYPE=RADIO, INPUT TYPE=RESET, INPUT TYPE=SUBMIT, INPUT TYPE=TEXT, INS, LI, OBJECT, OL, P, Q, S, SPAN, SUB, TABLE, TD, TH, TT, U, UL, VAR, XMP

See also

Concepts

border
border-style
Colors

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.