Welcome to adding links and images to your HTML! These two elements transform static text into interactive, visual web experiences.
Links connect web pages together, while images make your content come alive. Together, they're the heart of the modern web.
Engagement Message
Imagine the web with no links or images—how would that affect your experience?
Creating links uses the anchor tag: <a>
. The most important part is the href
attribute, which tells the browser where to go when clicked.
<a href="https://www.google.com">Visit Google</a>
The text between the tags becomes the clickable link text.
Engagement Message
What part of this code do you think users actually click on?
The href
attribute can link to different places. External links use full URLs like https://www.example.com
. Internal links use just the filename like about.html
.
You can even link to sections within the same page using #section-name
.
Engagement Message
Why might you want to link to a section within the same page?
Adding images uses the <img>
tag. Unlike other tags, it doesn't need a closing tag - it's self-closing! The attribute tells the browser which image file to display.
