HTML
height property
Example
An image with both height and width of 42 pixels:
Try it »
Browser support





All major browsers support the height property.
The height attribute specifies the height of the image, in pixels.
**Tip:** It is a good practice to specify the height and width attributes for an image. If these attributes are set, space can be 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 will change when the image loads.
**Tip:** Do not use the height and width attributes to scale images. If you shrink an image using these attributes, the user must download a large image (even if it looks small on the page). The correct approach is to process the image to an appropriate size with software before using it on the web page.
Differences between HTML 4.01 and HTML5
In HTML 4.01, the height should be defined in pixels or as a percentage of the containing element. In HTML5, the height value must be in pixels.
Syntax
Attribute values
| Value | Description |
|---|---|
| pixels | The height in pixels (such as height="100"). |
HTML tag