border-width

Sets the width of the top, right, bottom, and left borders of the object.

Syntax

{ border-width: sWidth }

Possible values

sWidth

String that specifies or receives up to four of the following values:

medium

Default.

thick

Width greater than the default.

thin

Width less than the default.

width

Width that consists of a floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).

For more information about valid width values, see Length units reference.

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

Remarks

Up to four different widths can be specified, in the following order: top, right, bottom, left. If one width is specified, it is used for all four sides. If two widths are specified, the first is used for the top and bottom borders, and the second is used for left and right borders. If three widths are specified, they are used for top, right/left, and bottom borders, respectively.

The border-width property does not render if the border-style property is set to none.

Examples

The following example uses the border-width property to specify the width of the border. This example uses a call to an embedded (global) style sheet to change the width of the border to 1 centimeter when a mouse click occurs:

<head><style>
    td { border-width: 3mm; }
    .changeborder 1 { border-width: 1cm; }
</style>
</head>
<body>
<table border >
<tr>
    <td onclick="this.className='changeborder 1'"
        ondblclick="this.className=''">
        <img src="sphere.jpg"></td>
</tr>
</table>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371314.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, HR, I, IFRAME, 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
border-style

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