HTML and CSS Reference
In-Depth Information The border properties
The border surrounding an element has a color, a thickness, and a style.
You can use various properties to control these three aspects of the bor-
der on each of the four sides of an element. Shorthand properties make
it easy to define the same color, thickness, and style for the entire bor-
der, if desired. Border properties are not inherited; you must explicitly
set them for each element that has a border. The border-color property
Use the border-color property to set the border color. If this property is
not specified, the browser draws the border using the value of the ele-
ment's color property.
The border-color property accepts from one to four color values. The
number of values determines how they are applied to the borders (sum-
marized in Table 8-1 ). If you include just one property value, all four
sides of the border are set to the specified color. Two values set the
top and bottom borders to the first value and the left and right borders
to the second value. With three values, the first is the top border, the
second sets the right and left borders, and the third color value is for
the bottom border. Four values specify colors for the top, right, bottom,
and left borders, in that order.
Table 8-1. Order of effects for multiple border, margin,
and padding property values
Number of
Affected border(s), margin(s), or padding
All items have the same value.
Search WWH ::

Custom Search