HTML me Images ka Use

Websites me images ka use visual appeal ke liye bahut important hota hai. HTML me images display karne ke liye <img> tag ka use kiya jata hai.

<img> Tag kya hai?

<img> ek self-closing (empty) tag hota hai jo kisi image ko webpage me embed karta hai. Is tag ke do important attributes hote hain:

Basic Syntax:

<img src="image.jpg" alt="Image description" />

Example:

<img src="https://www.example.com/images/logo.png" alt="Company Logo" width="200" height="100" />

Is example me image ko 200px width aur 100px height me display kiya gaya hai.

Important Attributes

Image Ko Link Banana

Aap kisi image ko clickable bana kar hyperlink bhi kar sakte hain. Iske liye <img> tag ko <a> tag ke andar rakhte hain.

<a href="https://www.example.com">
  <img src="logo.png" alt="Example Logo" />
</a>

Accessibility Importance

alt attribute dena zaruri hai taaki visually impaired users screen readers ka use karke samajh saken ki image me kya hai. Agar image important nahi hai toh alt="" bhi kar sakte hain.