HTML में <img> tag का use web page में image show कराने के लिए किया जाता है। <img> tage का closing tag नहीं होता है।

Example

<img src="image_location">

src attribute के लिए image path देते समय folders का ध्यान रखें अगर वह image किसी folder में है तो folder name के साथ image path दिया जाता है।
For Example :

<img src="folder1/folder2/image">

HTML Image Attributes

  1. src
  2. alt
  3. width & height
  4. style

HTML src Attribute

<img> tag में src सबसे important attribute होता है , इस attribute की value में ही हम उस image का path देते हैं जिसे show करना होता है।

HTML alt Attribute

tag में alt attribute का use image name देने के लिए किया जाता है , अगर दिए गए path / location पर image नहीं हुई या किसी दूसरी error की वजह से image show नहीं हुई तो alt attribute में दी गयी value show हो जायगी।

For Example -

<img src="image_tiger" alt="Tiger Image">

Output :
Tiger Image


तो कुछ इस तरह से alt attribute work करता है।

HTML width and height Attribute

<img> में width & height attributes का use image की width , height fix करने के लिए किया जाता है।
For Example -

<img src="/storage/uploads/course/html_1613310520.png" alt="HTML Image" width="150" height="150">

Output :
HTML Image

HTML style Attribute

इन सबके अलावा <img> tag में आप style attribute का भी use कर सकते हैं। हालाँकि आप चाहे तो width , height style attribute में भी define कर सकते हैं।
For Example -

<img src="/storage/uploads/course/html_1613310520.png" alt="HTML Image" style="width:150px;height150px;border:red">

Output :
HTML Image

I Hope अब आपको HTML में <img> tag के बारे में अच्छी तरह से पता चल गया होगा।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers