Easy Tutorial
❮ Ref Pxtoemconversion Att Link Target ❯

HTML <input> width Attribute

HTML <input> Tag

Example

Define an image as a submit button with height and width attributes:


Browser Support

All major browsers support the width attribute.


Definition and Usage

The width attribute specifies the width of an <input> element.

Note: The width attribute is only applicable to <input type="image">.

Tip: It is a good practice to specify both height and width attributes for images. If these attributes are set, the required space is reserved when the page is loaded. Without these attributes, the browser cannot understand the image's dimensions and cannot reserve appropriate space, leading to layout changes as the page and images load.


Differences Between HTML 4.01 and HTML5

The width attribute is a new attribute for the <input> tag in HTML5.


Syntax

Attribute Values

Value Description
pixels The width in pixels (e.g., width="100").
❮ Ref Pxtoemconversion Att Link Target ❯