style.border (Property)

A border round the styled element.


CSS level - 1
DOM level - 2
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.border
CSS syntax:border: aWidth aStyle aColor
Argument list:aWidthA border width value
aStyleA border style selector
aColorA color value

This property provides a way to set all four borders in one assignment. It takes three values. However, you must specify the border style value for it to have any effect. The three values to define are:

Of course, you can specify them individually if you prefer, but this property may provide a cleaner display transition.

The three items should be space separated and defined as they would be for the specific properties that operate on them individually. Because the properties use distinctly different namespaces, the values can be defined in any order so long as the style value is always present.

You should include the width attribute. In fact unless you are specifying all three values, this shortcut isn't much of a saving over the discrete property setting mechanisms.

Borders and outlines are similar but not the same. An outline is like a border but it is drawn within the extent of the object. A border is drawn outside the object. The width of a border is measured outwards from the edge of element while the outline width is measured inwards.

See also:color names, color value, Measurement units, style.borderColor, style.borderStyle, style.borderWidth, style.margin, style.outline, style.padding