# How to use height and width attributes in HTML?

HTMLWeb DevelopmentFront End Technology

The height and width attribute in HTML is used to specify the height and width of the element. The values are set in px i.e. pixels.

The height and width attribute is used in the following HTML elements:

 S. No Elements Attribute Attribute 1 element height width 2 element height width 3

To add an image in an HTML page, <img> tag is used. With that, we need to use the attributes height and width to set the height and width of the image in pixels.

## Example

You can try to run the following code to learn how to use height and width attributes in HTML.

<!DOCTYPE html>
<html>
</html>