The <img> tag use to define(show) an image in an HTML page.The two general attributes required for <img> tag are *src*,*alt*.Image is inserted in a web page by source link(address of server upload img). In HTML the <img> tag has no end tag while in XHTML the <img> tag must be properly closed.Dimensions(height&width) are also set by height and width attributes.Image should be in proper dimension before uploading at server it reduces the web page loading time.Image provides a marvellous look to a webpage.

You can understand use of <img> tag by a simple example:-

Unclickable Image:-
When you want to add an unclickable image you can useimg tag.

e.g.

<!DOCTYPE html>
<html>
<body>
<img src="http://lh5.googleusercontent.com/-vl88LT8- 2VI/AAAAAAAAAAI/AAAAAAAAADk/qZP_A1aQNZo/s80-c/photo.jpg" alt="HTML Tutorial" height="150" width="140" / >

</body>
</html>


Result:- indianwebschool


Clickable Image:-
When you want to add an image to a link(webpage) you can use anchor tag with img tag.

e.g.

<!DOCTYPE html>
<html>
<body>
<a href="https://indianwebschool.blogspot.com/"> <img src="http://lh5.googleusercontent.com/-vl88LT8- 2VI/AAAAAAAAAAI/AAAAAAAAADk/qZP_A1aQNZo/s80-c/photo.jpg" alt="HTML Tutorial" height="150" width="140" alt="indianwebschool" / ></a>

</body>
</html>


Result:- indianwebschool


The following attributes can be set for the <img> tag:-

<img> Tag Attributes

Attribute Value Description
align top Specifies the alignment for the image.
bottom
middle
left
right
alt text Specifies an alternate text for an image
src URL Specifies the URL of an image
vspace
hspace
pixels Specifies the whitespace on top and bottom of an image
pixels Specifies the whitespace on left and right side of an image
width
height
pixels Specifies the width of an image
pixels Specifies the height of an image


Conclusion:--

So the <img> tag use to insert a image in a webpage.It is inserted in webpage by image url.

<img> tag का उपयोग webpage में पिक्चर को Add करने के लिए किया जाता है यह webpage में url code के द्वारा add किया जाता है जिस पिक्चर को वेबपेज में add करना होता है उसे src attribute में define किया जाता है alt attribute का उपयोग पिक्टुरेस से related text को define करने के लिए किया जाता है

0 comments:

Post a Comment