Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

width property

Sets or retrieves the width of the object.


Integer value = object.put_width(Variant v);Integer value = object.get_width(Variant* sWidth);

Property values


auto (auto)

Default. Default width of the object.

width (width)

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 the supported length units, see CSS Values and Units Reference.

percentage (percentage)

Integer, followed by a %. The value is a percentage of the width of the parent object, whether or not it is specified explicitly. Negative values are not allowed.

String format

auto | width | percentage

CSS information

Applies ToAll elements
Initial Value


As of Microsoft Internet Explorer 6, when you use the !DOCTYPE declaration to specify standards-compliant mode, this property specifies the distance between the left and right edges of the content box—that is, within the IHTMLRuleStyle::padding.

When the !DOCTYPE declaration does not specify standards-compliant mode, and with earlier versions of Windows Internet Explorer, this property includes the object's content box, plus the values of the following properties: IHTMLRuleStyle::borderLeft, IHTMLRuleStyle::borderRight, IHTMLRuleStyle::paddingLeft, and IHTMLRuleStyle::paddingRight. Subtracting the sum of the values of these properties from the value of the IHTMLRuleStyle::width property equals the width of the parent object's content box.

To perform operations on the numeric value of this property, use IHTMLStyle::pixelWidth or IHTMLStyle::posWidth.

For more information about how to access the dimension and location of elements on the page through the Dynamic HTML (DHTML) Document Object Model (DOM), see Measuring Element Dimension and Location with CSSOM in Internet Explorer 9.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]







See also

Measuring Element Dimension and Location with CSSOM in Internet Explorer 9
Other Resources
CSS Enhancements in Internet Explorer 6



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.