📅 Week 2 - Day 1: Semantic HTML & Multimedia

Monday | Duration: 3 hours

🎯 Learning Objectives

  • Understand semantic HTML and its importance
  • Use structural tags: header, nav, main, article, section, aside, footer
  • Embed audio and video content
  • Build a complete news article page

📚 What is Semantic HTML?

Semantic HTML uses tags that clearly describe their meaning to both the browser and the developer.

Benefits:

  • Improves accessibility for screen readers
  • Better SEO (Search Engine Optimization)
  • Easier to maintain code
  • Clearer structure for developers

Non-Semantic vs Semantic

Non-Semantic Semantic
<div id="header"> <header>
<div id="nav"> <nav>
<div id="footer"> <footer>

🏗️ Semantic HTML Structure

<header> - Top section (logo, navigation)
<nav> - Navigation links
<main> - Main content area
<article> - Independent content
<section> - Thematic grouping
<aside> - Sidebar content
<footer> - Bottom section

Key Semantic Elements

1. <header>

Contains introductory content, typically logo, site title, and navigation.

<header> <h1>My Website</h1> <nav> <a href="/">Home</a> <a href="/about">About</a> <a href="/contact">Contact</a> </nav> </header>

2. <nav>

Contains navigation links.

<nav> <ul> <li><a href="/">Home</a></li> <li><a href="/blog">Blog</a></li> <li><a href="/services">Services</a></li> </ul> </nav>

3. <main>

The dominant content of the page. Only one per page.

4. <article>

Self-contained, independent content (blog post, news article).

<article> <h2>Article Title</h2> <p>Article content...</p> </article>

5. <section>

Thematic grouping of content.

6. <aside>

Side content, related to main content (sidebar, callout boxes).

7. <footer>

Footer information (copyright, contact, links).

🎵 Embedding Multimedia

Audio Element

<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>

Attributes:

  • controls - Shows play/pause buttons
  • autoplay - Starts automatically
  • loop - Repeats continuously
  • muted - Starts muted

Video Element

<video width="640" height="360" controls> <source src="video.mp4" type="video/mp4"> <source src="video.webm" type="video/webm"> Your browser does not support the video tag. </video>

Embedding YouTube Videos

<iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>

💻 Main Activity: Build a News Article Page

Create: news-article.html

Build a complete news page using semantic HTML and multimedia.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Latest Tech News</title> </head> <body> <header> <h1>Tech News Daily</h1> <nav> <a href="/">Home</a> | <a href="/news">News</a> | <a href="/tech">Technology</a> | <a href="/contact">Contact</a> </nav> </header> <main> <article> <header> <h2>AI Revolution in Web Development</h2> <p> <time datetime="2025-12-05">December 5, 2025</time> | By <strong>Ahmad Tijjani</strong> </p> </header> <figure> <img src="https://picsum.photos/800/400" alt="AI in Web Development"> <figcaption>Artificial Intelligence transforming web development</figcaption> </figure> <section> <h3>Introduction</h3> <p> Artificial Intelligence is revolutionizing how we build websites. From automated code generation to intelligent design suggestions, AI tools are making developers more productive than ever. </p> </section> <section> <h3>Key Benefits</h3> <ul> <li>Faster development cycles</li> <li>Improved code quality</li> <li>Better user experiences</li> <li>Automated testing</li> </ul> </section> <section> <h3>Watch the Interview</h3> <video width="640" height="360" controls> <source src="interview.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </section> <section> <h3>Expert Opinion</h3> <blockquote> "AI is not replacing developers; it's empowering them to focus on creative problem-solving rather than repetitive tasks." <footer>- Dr. Sarah Johnson, Tech Innovator</footer> </blockquote> </section> <footer> <p>Tags: #AI #WebDevelopment #Technology</p> <p>Share: <a href="#">Twitter</a> | <a href="#">Facebook</a></p> </footer> </article> <aside> <h3>Related Articles</h3> <ul> <li><a href="#">Future of JavaScript</a></li> <li><a href="#">CSS Grid Tutorial</a></li> <li><a href="#">Web Accessibility Guide</a></li> </ul> <h3>Listen to Our Podcast</h3> <audio controls> <source src="podcast.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> </aside> </main> <footer> <p>© 2025 Tech News Daily. All rights reserved.</p> <nav> <a href="/privacy">Privacy Policy</a> | <a href="/terms">Terms of Service</a> </nav> </footer> </body> </html>

✏️ Practice Exercises

Exercise 1: Personal Blog Post

Create a blog post about your web development journey using:

  • Proper semantic structure
  • At least 3 sections
  • An image with figure and figcaption
  • A blockquote with your favorite coding quote

Exercise 2: Add Multimedia

Enhance your page with:

  • An embedded YouTube video about web development
  • An audio element (use any online audio file)

✅ Today's Deliverable

  • news-article.html with complete semantic structure
  • Working audio and video elements
  • Personal blog post exercise completed
  • Committed and pushed to GitHub