English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The height attribute specifies the height of the image in pixels
Height and width are32Pixel Image:
!DOCTYPE html <html> <head> <title>HTML: <img> height Attribute - Basic Tutorial Website oldtoolbag.com</title> <body> <img src="haha.gif" alt="haha face" width="32" height="32"> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the height attribute.
The height attribute specifies the height of the image in pixels.
Tip:Always specify both the height and width attributes of the image. If height and width are set, the space required for the image is reserved when the page is loaded. However, if these attributes are not set, the browser will not know the size of the image and will not be able to reserve appropriate space for it. The effect is that the page layout will change during loading (when the image is loading).
Tip:Using the height and width attributes to shrink the size of large images forces the user to download the large image (even if it looks very small on the page). To avoid this, please resize the image programmatically before using the page.
In HTML 4.01In the value, the height can be defined in pixels or as a percentage of the containing element. In HTML5In the value, it must be specified in pixels.
<img height="pixels">
Value | Description |
---|---|
pixels | Height in pixels (for example height="50"). |