The width and height attributes can be applied to any of the following HTML elements:


From the HTML5 point of view it is important to mention that the <input /> element may have the height and / or eidth attributes assigned to it also. It is frequently used do type = "image" but it may be also used in other types as well, such as the type = "submit".


<input type="image" src="button.png" width="150" value="Submit" />

The values of the width and height attributes are expressed as numeric values in terms of the intrinsic unit of measurement of the associated resource. For instance, for a bitmap image such a .jpg or .png file, the attribute value is a number indicating a pixel value.

NOTE: that these attributes have lower precedence than any CSS styles applied.


Input tag with with height attribute example:


›› go to examples ››