Images bring life to web pages on the internet. To Insert image
in an HTML document <img> tag is used. For examle:
<img src="k2.jpg">
src is the URL of image. It is the required attribute. If
image is in the same folder then only image filename is enough.
If it is in a folder named images then it will be "images/filename.jpg".
Only images with extension .gif, .jpg or .jpeg and .png are supported
in HTML documents.
<img> tag has two dimension attributes i.e. height and width
that specify the dimensions of image in HTML document. If you specify
these attributes browser will allocate the specified dimensions
for the image while image is still loading. You can also use them
to alter the dimensions of images. Another attribute of <img>
tag is border, which specifies the size of border around image.
Lets see an example of <img> tag.
<img src=images/k2.jpg" width=308 height=234>
<br>
<img src=images/k2.jpg" width=154 height=117 border=2>
Output
Creating Links:
You can create hyperlinks to other pages and resources on internet
easily us <a> tag. <a> tag requires href attribute which
specifies the target URL. You can make any text or image a link
by enclosing it within <a> adn </a> tags. Two examples
of creating links are given below:
<a href="http://www.yahoo.com"> a link to Yahoo!
</a>
<br> <br>
Click on image to go to Yahoo! <br>
<a href="http://www.yahoo.com"><img src=images/k2.jpg"
width=154 height=117 border=0> </a>
Output
|