border

Sets the properties to draw around the object.

Syntax

{ border: sBorder }

Possible values

sBorder

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

color

Any of the range of color values available to the border-color property.

style

Any of the range of style values available to the border-style property. The default value is none.

width

Any of the range of width values available to the border-width property. The default value is medium.

This property has a default value of medium none. It is not inherited.

Remarks

The border property is a composite property that sets the width, style, and color values for all four sides of an object.

You must specify a style when specifying a width or color; otherwise, the border does not render.

All individual border properties not set by the composite border property are set to their default values. For example, the default value for width is medium.

The setting border=thin is identical to border-thin none; the default value for the border color is the same as the text color if one is not initially set. So, not only does the property set width to thin, but it also clears any style or color values that were previously set.

If a color is not specified, the text color is used.

Examples

The following example uses the border property to specify the composite border properties. This example uses a call to an embedded (global) style sheet to modify the border property:

<head><style>
    .applyborder { border: 0.2cm groove orange; }
    .removeborder { border: none; }
</style>
</head>
<body>
<table border >
<tr> 
    <td onmouseover="this.className='applyborder '" onmouseout="this.className='removeborder '">
    <img src="sphere.jpg"></td>
</tr>
</table>

Standards information

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Ee371279.xtlink_newWindow(en-us,Expression.40).png and in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371279.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, i, 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-width
border-style
border-color

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