border-width Attribute | borderWidth Property

MS Office DHTML, HTML & CSS

border-width Attribute | borderWidth Property


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

Syntax

HTML{ border-width: sWidth }
Scriptingobject.style.borderWidth [ = sWidth ]

Possible Values

sWidth String that specifies up to four of the following values:
mediumDefault width.
thinWidth less than the default.
thickWidth greater than the default.
widthWidth consisting of a floating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex).

The property is read/write with a default value of medium; the cascading style sheets (CSS) attribute is not inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

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.

To use this property, inline elements must have an absolute position or layout. Element layout is set by providing a value for the height property or the width property.

The borderWidth property does not render if the borderStyle property is set to none.

Example

The following examples use the border-width attribute and the borderWidth 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.

Sample Code

<HEAD>
<STYLE>
    TD { border-width:3mm }
    .changeborder1 { border-width:1cm }
</STYLE>
</HEAD>
<BODY> 
<TABLE BORDER>
<TR>
    <TD onclick="this.className='changeborder1'"
        ondblclick="this.className=''">
        <IMG src="sphere.jpg"></TD>
</TR>
</TABLE>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

This example uses inline script to change the width of the border to 1 centimeter when a mouse click occurs.

<TD onclick="this.style.borderWidth='1cm'">

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, currentStyle, custom, DD, DIR, DIV, DL, DT, EMBED, FIELDSET, FORM, Hn, HR, 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, ISINDEX, LI, LISTING, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, runtimeStyle, SPAN, style, TABLE, TD, TEXTAREA, TH, UL, XMP

See Also

border


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.