3. The <img> Tag (Embedding Images)
Used to insert an image in an HTML page.
Basic Syntax:
<img src='image.jpg' alt='Description of image'>
<img src="image.jpg" alt="Beautiful Scenery"
width="300" height="200">
Attributes:
- src: Specifies the image file path
- alt: Alternative text if the image doesn't load.
- width & height: Controls image size
4. The <a> Tag (Hyperlinks)
Anchor tag Used to create hyperlinks to other pages
or files.
Basic Syntax:
<a href='https://www.example.com'>Visit
Example</a>
Attributes:
- href: URL of the page/file- Links to an external
website.
- target: '_self' (same tab), '_blank' (new tab)
5. Combining Images & Hyperlinks
Click on an Image to Open a Link:
<a href='https://www.nature.com'>
<img src='nature.jpg' alt='Nature' width='300'>
</a>
6. Download Link using <a> Tag
Create a Downloadable File Link:
<a href='documents/sample.pdf'
download>Download PDF</a>
The 'download' attribute forces the file to be
downloaded instead of opened in the browser.
7. Summary
✔ Use the <img> tag to insert images.
✔ The <a> tag creates hyperlinks.
✔ Attributes like href, src, alt, target, and
download control behavior.
✔ Images can also act as clickable links.
8. Practical Activity
✅ Create an HTML page with:
1. An image of your choice.
2. A link to another website.
3. A downloadable file link.