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

offsetWidth property

Retrieves the width of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

Syntax

HRESULT value = object.get_offsetWidth(* p);

Property values

Type: long

the width, in pixels.

Remarks

You can determine the location, width, and height of an object by using a combination of the IHTMLElement::offsetLeft, IHTMLElement::offsetTop, IHTMLElement::offsetHeight, and IHTMLElement::offsetWidth properties. These numeric properties specify the physical coordinates and dimensions of the object relative to the object's offset parent.

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

To comply with the Cascading Style Sheets, Level 1 (CSS1) box model, Microsoft Internet Explorer 6 and later calculate the height of objects differently when you use the !DOCTYPE declaration in your document to switch on standards-compliant mode. This difference may affect the value of the IHTMLElement::offsetWidth propety. When standards-compliant mode is switched on, the IHTMLCurrentStyle::width property specifies the distance between the left and right edges of the bounding box that surrounds the object's content. When standards-compliant mode is not switched on, and with earlier versions of Windows Internet Explorer, the IHTMLCurrentStyle::width property also includes the IHTMLRuleStyle::border and IHTMLRuleStyle::padding belts that surround the object's bounding box. For more information, see CSS Enhancements in Internet Explorer 6.

 

 

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

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.