HTML width property
Example
Define an image as a submit button with height and width attributes:
Try it »
Browser support





All major browsers support the width property.
Definition and Usage
The width attribute specifies the The width of the element.
**Note:** The width attribute only applies to .
**Tip:** It is a good practice to specify the height and width attributes for an image. If these attributes are set, the required space is reserved for the image when the page loads. Without them, the browser cannot know the image's dimensions and cannot reserve appropriate space, so the page layout changes as the page and image load.
Differences between HTML 4.01 and HTML5
The width attribute is new in HTML5 for the tag.
Syntax
Attribute values
| Value | Description |
|---|---|
| pixels | Width in pixels (such as width="100"). |
HTML tag