Image height and width attribute in HTML

Let’s say you are developing a website and want to add an image. For this, the <image> tag is used. But, what about the height and width of the image, which is necessary to be set while adding an image on a web page.

To add height and with of an image, use the height and width attribute, respectively in the <img> tag. Let’s say we have an image with the following link:

Now, to add it on the web page, use the <img> tag. Set the height and width attributes as well:

Remember, the height and wisth of an image is set in pixels. Therefore, we have set the height and width as 400 pixels and 600 pixels respectively.

Example

Let us now see an example to set an image with height and width on a web page:

Output

HTML img height and width attribute

The href attribute in HTML Page
Inserting Hyperlinks on an HTML web page
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading