XML technologies / CSS / Advanced websites with CSS / CSS property reference / border-color
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The shorthand property border-color describes the border color of an HTML element for each individual side.
The properties border-bottom-color, border-left-color, border-right-color and border-top-color let you define border colors separately for each side.
Inherited: no
Values
The following table shows the different value combinations for border-color. Colors are declared using valid CSS color values (see CSS color reference).
Table: Values for border-color.
Number of values | Effect on border rendering |
|---|---|
1 | All four border sides receive the specified value. |
2 | The first value applies to the top and bottom borders; the second to the left and right borders. |
3 | The first value applies to the top border, the second to the left and right borders, and the third to the bottom border. |
4 | The first value applies to the top border, the second to the right border, the third to the bottom border, and the fourth to the left border. |
Default value: Valid values of the property color of the element, either explicitly specified or inherited from its parent.
Compatibility
CSS version: 1
Works in all CSS-capable browsers, including Internet Explorer 4 and later and Netscape 4 and later. Netscape 4.x supports only single-color borders.
Example
The following style rule gives elements blockquote blue top and bottom borders and red left and right borders:
blockquote {
border-color: blue red;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg