ITP

BSc IT - Web Designing

Explain img tag with example

In : BSc IT Subject : Web Designing

The img tag is used to embed images  into a web page. Unlike other HTML tags, img is an empty tag , meaning it doesn't have a closing tag. Instead, all the necessary information about the image is provided within the opening tag using attributes .

<img src="image-url" alt="description" width="..." height="..." />

src - Specifies the source (URL) of the image. Required.
alt - Provides alternative text if the image fails to load or for accessibility.
width - Sets the width of the image in pixels or percentage.
height - Sets the height of the image.
title - Displays extra information about the image as a tooltip when hovered.

<img 
  src="https://www.example.com/images/puppy.jpg " 
  alt="A cute puppy playing with a ball" 
  width="300" 
  height="200" 
  title="Cute Puppy"
/>

About us

A truly open platform where you may ask questions and get answers. We also provide comprehensive and easy-to-understand answers to question papers.  discover...

Site status

Flag Counter

Privacy Policy

Sitemap