HTML provides various tags to create interactive and visually appealing web pages. Among them, the <a> (anchor) tag and <img> (image) tag are very important.
Anchor and Image Tag in HTML
Anchor tag
The anchor tag in HTML is used to create hyperlinks between two pages for navigation. The most important attribute of an anchor tag is βhref,β which specifies the destination of the link.
Example:
<a href="https://www.google.com">Visit Google</a>Linking between sections of different documents
Suppose you want to link document A (fileA.html) to another document B (fileB.html). To link the document, you have to write the following code in the document A.
<a href="fileB.html"> Open the document B. </a>Image Tag
The image tag in HTML helps to display images on a webpage. The image tag is the most commonly used tags in web design. The image tag does not have a close tag, which means the image tag is an empty tag. Different attributes are used in the image tag. The important tags are:
- scr: It helps to specify the path or URL of the image file.
- alt: It provides alternative text if the image cannot be displayed and also improves accessibility.
- Width: It helps to set the width of the image.
- height: It helps to set the height of the image.
- align: It is used to align the image in the HTML.
Example:
<img src="mountain.jpg" alt="Snowy mountain peak" width="400" height="250">Disclaimer: We have provide you with the accurate handout of βAnchor and Image Tag in HTMLβ. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above study material present on our websites is for education purpose, not our copyrights.
Images and content shown above are the property of individual organisations and are used here for reference purposes only. To make it easy to understand, some of the content and images are generated by AI and cross-checked by the teachers.