IMG.width (Property)

The width of the image on the client display surface.


DOM level - 1
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Property/method value type:String primitive
JavaScript syntax:-myIMG.width

The image space is defined by an extent rectangle that surrounds the space occupied by it on the screen. The extent rectangle is the smallest rectangle that can completely enclose the item. This property specifies the width of that extent rectangle.

Including height and width information on images is optional but it can significantly improve the performance of the layout engine as it renders the web page. This is because the layout engine does not need to wait until the image has been fetched before reserving sufficient space for it in the display.

See also:Image.height, Image.width, IMG.height