Image Tag
Image Tag
Images make a webpage more attractive. Images describe our products, when we add images related to our products. Images are important in a website for easily explained to visitors. Image tag does not contain closing tag, it contain attributes such as add a path of image, set width and height, show alternate text.
Example:
You can see in the below syntax, a image tag with the attributes .
Syntax:
<html> <head> <title> Page Title </title> </head> <body> <img src="image-name.jpg" alt="Description of image" width:"100px" height="100px"> </body> </html>
SRC:
SRC attribute is to add image by it’s path. Your PC have folder which has image for your webpage then you can add the accurate path in the SRC i.e. src=”Desktop/folder-name/image-name.jpg”
ALT:
ATL attribute is to show text for image when you keep mouse over the image.
Size Of Image
You can set height and width as an attribute inside the image tag.
Example:
<img src="image-name.jpg" alt="Description of image" width: "500" height: "500px">
Image Link
You can make your image clickable. You can visit to another webpage by clicking on image. You can wrap your image tag inside the anchor tag and when you click on that, image will a worked as a link.
Syntax:
<a href="https://www.google.com/"> <img src="image-name.jpg" alt="Description of image" width: "500" height: "500px"> </a>