Saturday, March 11, 2017

Images in HTML



By using image tag (<image>) we can provide image to the web page.  In image tag we have the following attributes.
1. Source
2. Align
3. Width
4. Height
5. Border
6. Horizontal space
7. Vertical space

Source (<src>):
   In source attribute we give the image location. The image formats are JPEG, PNG or GIF.
alt attribute is a mandatory attribute. If image cannot be displayed then specified text will be displayed.  
Example:
<image src=” D:\fly.jpg” alt=”fly”>

Align:
   In align attribute we give the position of an image.  The position are left, right, top, bottom and center.
Example:
<image src=”fly.png” alt=”fly” align=”center”>

Width:
   By using width attribute we can mention the width of an image.

Height:
   By using height attribute we can provide the height of an image.
Example:
<image src=”fly.png” alt=”fly” width=”200” height=”120”>

Border:
Image will have a border around it, you can specify border thickness in terms of pixels using border attribute.
Example:
<image src=”fly.png” alt=”fly” border=”5”>

Horizontal space (hspace):
   By using horizontal space we can provide horizontal space to an image.

Vertical space (vspace):
   By using vertical space we can provide vertical space to an image.
Example:
<image src=”sunset.jpg” alt=”sun set” vspace=”50” hspace=”30”>

Example program:
<html>
<head>
<title>Set Image Alignment</title>
</head>
<body>
<p>Setting image Alignment</p>
<img src="Pawanism.jpg" alt=" pavan kalyan" border="3" align="right" width="200" height="200" vspace="100" hspace="200">
</body>
</html>

Output:

 

<--Back to HTML Common tag 

No comments:

Post a Comment