How to add images to a webpage
A webpage without images will not look good. Pages with more images can attract large number readers than pages without images.
The element img will be used to insert an image in to a webpage. This img element should be defined differently for HTML and XHTML.
Actually, empty elements like <img> may not necessarily to close with an end tag in HTML. Wherein XTHML markup, every elements must be closed with an end tag.
Sample image tag for HTML:
<img src="images/screenshot.jpg" width="300" height="225" alt="alt text">
Sample image tag for XHTML:
<img src="images/screenshot.jpg" width="300" height="225" alt="alt text" />
Suppose, if you want to assign a link to the image, the code should look like
For HTML
<a href="#"><img src="images/screenshot.jpg" alt="alt text" width="300" height="225" border="0"></a>
For XHTML
<a href="#"><img src="images/screenshot.jpg" alt=" alt text " width="300" height="225" border="0" /></a>




(average: 4.00 out of 5)


3 Comments
Hey its working man.thanks
H,
Really cool and must tutorial. If you add some coding before and after the image tag (coding) (i.e ) where the coding should be, then it will really helps the Starter like me. Its just a suggestion.
its good man