0% found this document useful (0 votes)
3 views

Image Tag in HTML

The HTML <img> tag is used to embed images in a webpage, requiring 'src' for the image path and 'alt' for alternate text. Additional attributes include 'height' and 'width' for image dimensions, and optional attributes like 'ismap' and 'sizes' for advanced functionalities. Examples demonstrate the basic usage of the <img> tag with various attributes, including styling options.

Uploaded by

amitakhare092
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Image Tag in HTML

The HTML <img> tag is used to embed images in a webpage, requiring 'src' for the image path and 'alt' for alternate text. Additional attributes include 'height' and 'width' for image dimensions, and optional attributes like 'ismap' and 'sizes' for advanced functionalities. Examples demonstrate the basic usage of the <img> tag with various attributes, including styling options.

Uploaded by

amitakhare092
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

IMAGE TAG IN HTML

The HTML <img> tag is used to add images inside the webpage/website.
Nowadays website does not directly add images to a web page, as the images are
linked to web pages by using the <img> tag which holds space for the image.
The <img> tag has two required attributes:
 src – It specifies the path to the image
 alt – It specifies an alternate text for the image if the image for any reason
cannot be displayed on the webpage.
Syntax of image tag:
<img src=”” alt=”” width=”” height=””>

Attributes used in image tag :


Attribute Description

src Specifies the path to the image.

Provides alternate text for the image,


useful for informing users about the
alt
image and displaying in case of
network issues.

height Specifies the height of the image.

width Specifies the width of the image.

Specifies an image as a server-side


ismap
image map.

Specifies image sizes for different page


size
layouts.
Example 1: The implementation of the <img> tag along with src, width, height,
and alt attributes.
<body style="text-align: center;">
<h3>GeeksforGeeks logo</h3>

<img src=
"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png "
width="420" height="100"
alt="Geeksforgeeks.org">
</body>

Example 2: The implementation of the style attribute to add a border to


the image.
<body style="text-align: center;">
<h3>GeeksforGeeks logo</h3>

<img src=
"https://media.geeksforgeeks.org/wp-content/uploads/
geeksforgeeks-13.png"
width="420" height="100"
alt="Geeksforgeeks.org"
style="border:5px solid black">
</body>

You might also like