This tag is used to insert an image in the HTML of document.
Attributes of IMAGE:
- Align: It sets the alignment of text, which follows the image reference relative to the image on the screen. To indicate horizontal alignment in the browser window the image we can use left and right attributes.
- Border: It sets whether the image has borders or not. If it has how thick the border.
- Height: This attribute indicates the height of image to be displayed in the HTML.
- SRC (source): This attribute specifies the path or location of the image to be display in the path.
- Width: This attribute specifies the width of the image in the HTML.
Note: The width and height can be specified on pixels and percentage. - hspace (horizontal Space): This attribute specifies an empty space on left and right side of the image.
- Alt ( Alternate Text): This attribute is used to display a message in the browser when image is not loaded on to the browser.
- vspace (Vertical Space): This attribute specifies an empty space on top and bottom of the image
Example:
<<img src = “smile.jpg” borders = “2” width = “200” height = “300” alt = “ABC Ltd” vspace = “20” hspace = “20” />
Example Program:
<html>
< !— using image as link anchors — >
<head>
<title> Adv.java programming </title
</head>
<body BGCOLOR = “black”>
<center>
<a href = “main. html”>
click here
</a>
<a href = “c:windows\…… .jpj”>
click here
</a>
<a href = “link.html”>
<img src = “smile.jpg” border= “2” width= “50” height =”90″ alt = “abc Ltd” vspace = “20” hspace = “20 />
</a> <br>
</center>
</body>
</html>