border-top-width Attribute | borderTopWidth Property
Sets or retrieves the width of the top border of the object.
Syntax
HTML { border-top-width: sWidth } Scripting object.style.borderTopWidth [ = sWidth ]
Possible Values
sWidth String that specifies one of the following values:
medium Default width. thin Less than the default width. thick Greater than the default width. width Floating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). For more information about the supported length units, see CSS Length Units. 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 properties
.
Remarks
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 property is supported on block and replaced objects only.
Example
The following examples use the border-top-width attribute and the borderTopWidth property to specify the width of the top border.
This example uses a call to an embedded (global) style sheet to change the width of the top border to 1 centimeter when a mouse click occurs.
Sample Code
<HEAD> <STYLE> TD { border-top-width:3mm } .changeborder1 { border-top-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.![]()
This example uses inline script to change the width of the top border to 1 centimeter when a mouse click occurs.
<TD onclick="this.style.borderTopWidth='1cm'">
Applies To
[ Object Name ] Platform Version 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
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.