Dofactory.com
Dofactory.com

HTML <img> height Attribute

The height attribute on an <img> tag sets the height of the image.

The height is specified in pixels - without the ‘px‘ unit.

Example

#

An <img> element with a height attribute.

Van Gogh, Self-portrait
<img src="/img/html/vangogh.jpg" height="250"
     alt="Van Gogh, Self-portrait" />

Using height

The height attribute specifies the height of the image.

The height is specified in pixels -- without the 'px' unit.

Percentages (%) are not allowed, but most browsers do support it.

Alternatively, use the CSS height property.


Syntax

<img height="pixels" />

Values

#

Value Description
pixels Height of the image in pixels (e.g. 150).

Browser support

Here is when height support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <img>

Last updated on Sep 30, 2023




Guides