Name

border — NN n/a IE 4 CSS 1

Synopsis

Inherited: No

A shorthand attribute for setting the width, style, and/or color of all four borders around an element in one assignment statement. Whichever attributes you don’t explicitly set with this attribute assume their initial values. Numerous other attributes allow you to set the width, style, and color of individual edges or groups of edges, if you don’t want all four edges to be the same.

Due to differences in the way browsers define their default behavior with regard to borders, every style sheet border rule should include the width and style settings. Failure to specify both attributes may result in the border not being seen in one browser or the other.

CSS Syntax

border: border-width || border-style || color

Value

For the border-width and border-style attribute values, see the respective attributes in this chapter. For details on the color value, see the section about colors at the beginning of this chapter.

Initial Value

None.

Example

P {border: groove darkred 3px}

Applies To

All elements (CSS); block and replaced elements (IE).

Object Model Reference

IE

[window.]document.all.elementID.style.border

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.