- HTML <img> tag is used to display images in the web page.
- The images are just linked, not inserted into the web page. The <img> creates a holding space for the image.
- The <img> tag is an empty tag that doesn't have a closing tag. It contains only attributes.
- The required attributes of the <img> tag are
- src - Specifies the path of the image
- alt - Specifies alternate text for the image
<img src="url" alt="alternate-text">
- border - sets a border for the image by specifying in pixels.
- width, height - define width and height of the image in pixels or percentage.
- vspace, hspace - define the horizontal and the vertical space between the text and the image when text is wrapped around the image.
- align - defines the image alignment.
<!DOCTYPE html>
<html>
<head>
<title>HTML Image Example</title>
</head>
<body>
<img src="img/v-color.jpg" width="30%" height="30%" align="center" vspace="5" hspace="10">
<p>Buy T-shirt</p>
</body>
</html>
No comments:
Post a Comment