Chapter 6 – Media & Multi-Page Websites

Table of Contents


What is Multimedia?

Multimedia comes in many different formats. It can be almost anything you can hear or see, like images, music, sound, videos, records, films, animations, and more.

Web pages often contain multimedia elements of different types and formats.

Types of Multimedia:

Basic Image Example:

Click to view code example
<img src="images/cat.jpg" alt="Image of a cat" width="300" height="200">

Live Example:

Image of a cat

Why Use Multimedia?


Browser Support

The first web browsers had support for text only, limited to a single font in a single color.

Later came browsers with support for colors, fonts, images, and multimedia!

Modern Browser Features:

Cross-Browser Compatibility:

Always test your multimedia content across different browsers:

Browser MP4 Video WebM Video MP3 Audio WAV Audio
Chrome
Firefox
Safari
Edge

Best Practices for Browser Support:


Multimedia Formats

Multimedia elements (like audio or video) are stored in media files.

The most common way to discover the type of a file, is to look at the file extension.

Multimedia files have formats and different extensions like: .wav, .mp3, .mp4, .mpg, .wmv, and .avi.

Common File Extensions:

Media Type Extensions Description
Images .jpg, .png, .gif, .svg, .webp Static and animated images
Audio .mp3, .wav, .ogg, .aac, .m4a Sound files and music
Video .mp4, .webm, .ogg, .avi, .mov Moving pictures with sound
Documents .pdf, .doc, .txt, .html Text and formatted documents

Choosing the Right Format:

Format Conversion:

You can convert media files using various online tools and software:


Common Video Formats

There are many video formats out there. The MP4, WebM, and Ogg formats are supported by HTML. The MP4 format is recommended by YouTube.

Format Description
MPEG .mpg .mpeg - MPEG. Developed by the Moving Pictures Expert Group. The first popular video format on the web. Not supported anymore in HTML.
AVI .avi - AVI (Audio Video Interleave). Developed by Microsoft. Commonly used in video cameras and TV hardware. Plays well on Windows computers, but not in web browsers.
WMV .wmv - WMV (Windows Media Video). Developed by Microsoft. Commonly used in video cameras and TV hardware. Plays well on Windows computers, but not in web browsers.
QuickTime .mov - QuickTime. Developed by Apple. Commonly used in video cameras and TV hardware. Plays well on Apple computers, but not in web browsers.
RealVideo .rm .ram - RealVideo. Developed by Real Media to allow video streaming with low bandwidths. Does not play in web browsers.
Flash .swf .flv - Flash. Developed by Macromedia. Often requires an extra component (plug-in) to play in web browsers.
Ogg .ogg - Theora Ogg. Developed by the Xiph.Org Foundation. Supported by HTML.
WebM .webm - WebM. Developed by Mozilla, Opera, Adobe, and Google. Supported by HTML.
MPEG-4 or MP4 .mp4 - MP4. Developed by the Moving Pictures Expert Group. Commonly used in video cameras and TV hardware. Supported by all browsers and recommended by YouTube.

Note: Only MP4, WebM, and Ogg video are supported by the HTML standard.

Recommended Video Settings:


Common Audio Formats

MP3 is the best format for compressed recorded music. The term MP3 has become synonymous with digital music.

If your website is about recorded music, MP3 is the choice.

Format Description
MIDI .mid .midi - MIDI (Musical Instrument Digital Interface). Main format for all electronic music devices like synthesizers and PC sound cards. MIDI files do not contain sound, but digital notes that can be played by electronics. Plays well on all computers and music hardware, but not in web browsers.
RealAudio .rm .ram - RealAudio. Developed by Real Media to allow streaming of audio with low bandwidths. Does not play in web browsers.
WMA .wma - WMA (Windows Media Audio). Developed by Microsoft. Plays well on Windows computers, but not in web browsers.
AAC .aac - AAC (Advanced Audio Coding). Developed by Apple as the default format for iTunes. Plays well on Apple computers, but not in web browsers.
WAV .wav - WAV. Developed by IBM and Microsoft. Plays well on Windows, Macintosh, and Linux operating systems. Supported by HTML.
Ogg .ogg - Ogg. Developed by the Xiph.Org Foundation. Supported by HTML.
MP3 .mp3 - MP3 files are actually the sound part of MPEG files. MP3 is the most popular format for music players. Combines good compression (small files) with high quality. Supported by all browsers.
MP4 .mp4 - MP4 is a video format, but can also be used for audio. Supported by all browsers.

Note: Only MP3, WAV, and Ogg audio are supported by the HTML standard.

Recommended Audio Settings:


HTML Media Elements

HTML allows you to embed audio, video, and other media directly into your web pages using the <audio>, <video>, and <iframe> elements.

Audio Example

Click to view code example
<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  <source src="audio.ogg" type="audio/ogg">
  Your browser does not support the audio element.
</audio>

Video Example

Click to view code example
<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
  Your browser does not support the video tag.
</video>

YouTube Embed Example

Click to view code example
<iframe src="https://www.youtube.com/embed/y3OOaXrFy-Q" title="YouTube video" frameborder="0" allowfullscreen></iframe>

Creating Multi-Page Websites

Most websites consist of multiple pages connected through navigation. This section covers how to structure and link multiple HTML pages together.

Website Structure

A typical website structure includes:

Navigation Menu

Click to view code example
<nav>
  <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About</a></li>
    <li><a href="contact.html">Contact</a></li>
  </ul>
</nav>

Internal Links

Use relative paths for linking between pages in the same website:

<a href="about.html">About Us</a>
<a href="pages/contact.html">Contact</a>
<a href="../index.html">Back to Home</a>

Consistent Layout

Use the same header, navigation, and footer on all pages:

<header>
  <h1>My Website</h1>
  <nav>
    <!-- Navigation menu -->
  </nav>
</header>

<main>
  <!-- Page content -->
</main>

<footer>
  <p>&copy; 2024 My Website</p>
</footer>

Best Practices



Congratulations! 🎉
You’ve completed the HTML course.

Reference Video for Chapter 6


Chapter 6 Summary

Key Takeaways

What You Learned

In this final chapter, you completed your HTML journey:

Congratulations! 🎉

You've successfully completed the HTML learning journey! You now have the skills to:

What's Next?

Your HTML foundation is solid! Consider these next steps:

Keep Learning!

Your HTML journey continues... Take the Practice Quiz →