Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

2.3.1.53 width

width of type DOMString

Retrieves the width of the object, in pixels.

Possible values are:

  • width – Integer that specifies the width of the object, in pixels, or as a percentage.

  • percentage – String that specifies an integer value followed by a %. The value is a percentage of the width of the parent object.

If you specify the width property of an img element, but not the height property, the resulting height of the image is sized proportionally to the specified width property and the actual height, in pixels, of the source image file.

If you specify the width property of an img, and the height and width of the image in the source file are identical, the height of the image matches the width.

If dynamic changes are intended for the height and width, the original values should be set through style (for example, "style=''height:200px; width:200px'') rather than through the height and width attributes.

The width attribute extends the following interfaces:

Show:
© 2016 Microsoft