Links (Anchors) and Images
Hyperlinks and images transformed the internet from isolated text documents into a rich, interconnected global web.
What is it?
The anchor element `<a>` creates hyperlinks to other web pages, files, email addresses, or page locations. The `<img>` element embeds visual images into the document.
Why is it used?
Hyperlinks allow navigation across the web, while images provide crucial visual explanations, product photography, diagrams, and branding.
Detailed Explanation
Syntax Structure
<!-- Hyperlink -->
<a href="destination-url" target="_blank">Link text</a>
<!-- Image -->
<img src="image-path.jpg" alt="Descriptive text" width="600" height="400" loading="lazy">
Code Example
<!-- Internal and External Navigation -->
<nav>
<a href="#curriculum">Jump to Curriculum</a> |
<a href="tel:8010294703">Call Us: 8010294703</a>
</nav>
<section id="curriculum">
<h2>Course Banner</h2>
<img
src="https://images.unsplash.com/photo-1517694712202-14dd9538aa97?w=600&auto=format&fit=crop"
alt="Student learning coding on laptop at IGM Computer Institute"
width="600"
height="340"
loading="lazy"
>
<p>Join thousands of successful KLiC graduates.</p>
</section>
Explanation of the Code
Expected Output
Real-World Application
E-commerce stores (Amazon, Flipkart) require high-performance images with descriptive `alt` tags and dynamic anchor links for every product card.
Common Mistakes to Avoid
Quick Practice Challenge
Create an image tag of your favorite programming logo with lazy loading, proper width/height, and descriptive alt text.