<img> Tag in HTML

The <img> tag in HTML is used to embed images into a webpage. It is an inline element, meaning it does not create line breaks in the document. The <img> tag requires at least one attribute: src, which defines the source (location) of the image file. Additionally, it is recommended to use the alt attribute to provide alternative text for the image if it cannot be displayed.

Key Points on <img> Tag:

Syntax of <img> Tag:

Syntax Example

<img src="image_path" alt="description" width="500" height="400">

Example of <img> Tag in HTML:

This example demonstrates how to use the <img> tag to display an image sourced from the LBSNAA website.

Code Example


        <img src="B1.jpg" alt="Sample Image" width="50%" height="30%">
                

Output

Sample Image

The <img> tag is widely used for embedding images into websites, whether for logos, photos, or other content. Always provide an alt attribute to ensure better accessibility and SEO.