You are here: Reference > HTML > attributes > width (embed, iframe, img, table, ...)

width attribute (embed, iframe, img, table, ...)

Browser support:
Specifies the default width of the element.
This attribute is deprecated. Use the width style property instead.
JavaScript page for this attribute: width. You can find other example(s) there.

Possible values:

String that sets the width of the object.
One of the following values:
Number(px)
Integer that specifies the width of the object, in pixels.
percentage
Integer in the range 0-100 followed by a %.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the width attribute:
<img id="myImage" src="picture.gif" height="100px" width="100px" />
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<img id="myImage" src="picture.gif" style="height:100px; width:100px" />
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content