HTML image tag

html image tag

Learn how to add images in webpages using HTML image tag. You can display images content by adding the URL of the image in <img> tag.

There are two attributes of the tag to add images with alt text. These are src and alt HTML attributes to specify the images.

The alt attribute can be used to add alternate text to show. The alternate text will appear only when the image URL or the media is not available.

Syntax

Example

Output

HTML image

List of HTML image tag attributes

Sr. No.image attributesDescription
1srcUsed to get the url location of the image from where we get the image.
2altUsed to show the alternative text when the server not able to find the image in the given location.
3widthUsed to define the width of the image.
4heightUsed to define the height of the image.

Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.