By the end of this lesson, you will be able to:
Make sure you have:
:information_source: Info What is HTML Media? HTML Media means adding pictures, videos, sounds, and other fun content to your web pages! Just like how you add photos to a school project, you can add media to make your websites more interesting and interactive.
Media elements include:
<img>
) - Pictures and graphics<a>
) - Clickable connections to other pages<iframe>
) - Windows to show other websites<video>
) - Movie clips<audio>
) - Sound and musictip Why Use Media? Think about your favorite websites. They probably have:
Without media, websites would just be plain text - pretty boring! :emoji:
:information_source: Info What is an Anchor Tag? The anchor tag (
<a>
) creates clickable links on your web page. It's like a magic portal that takes you from one page to another! When you click on a link, you jump to a new location - it could be another page on your site, a different website, or even a specific spot on the same page.
The anchor tag needs a special attribute called "href" (which stands for "hypertext reference"). This tells the browser where to go when someone clicks the link.
:memo: Key Points
- The
href
attribute holds the destination address- You can link to websites, files, or email addresses
- The text between the tags becomes clickable
- Always use descriptive text for your links (not just "click here")
Block
Output
tip Try This! Create links to:
mailto:
):information_source: Info What is an Image Tag? The image tag (
<img>
) displays pictures on your web page. Unlike most HTML tags, the image tag doesn't have a closing tag - it's self-closing! This tag turns your web page from plain text into a visual experience.
The <img>
tag needs two important attributes:
:memo: Why Alt Text Matters Alt text helps:
- People using screen readers understand your images
- Show text if the image doesn't load
- Search engines understand your content
- Everyone know what the image shows
Let's see how to create a music selection page using image tags!
Block
Output
tip Image Tips
:information_source: Info What is an Iframe? An iframe (inline frame) is like a window on your web page that shows content from another website. Imagine cutting a hole in your paper and placing another paper behind it - that's what an iframe does digitally! You can show YouTube videos, maps, or even other websites inside your own page.
The <iframe>
tag uses these attributes:
:memo: Size Options You can set sizes in two ways:
- Pixels (exact size): width="500" height="300"
- Percentages (flexible size): width="100%" height="50%"
Percentages make your iframe responsive - it adjusts to different screen sizes!
Block
Output
tip Common Iframe Uses
In this lesson, you learned three powerful media tags:
<a>
) - Creates clickable links to connect pages<img>
) - Displays pictures and graphics<iframe>
) - Shows content from other websitesEach tag helps make your website more interactive and engaging. Remember:
Problem: My image won't show up!
Problem: My link doesn't work!
Problem: My iframe is blank!
Ready to see everything in action? Watch this video to review what you've learned:
Now it's your turn! Try these challenges:
:memo: Remember The best way to learn is by doing! Don't worry if your first attempts aren't perfect. Every web developer started exactly where you are now. Keep practicing with your blocks, and soon you'll be creating amazing media-rich websites! :star2: