Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    </>HTML

    Document foundations

    • What is HTML?
    • Metadata and language
    • Attributes and character references
    • Headings, paragraphs and formatting

    Content and media

    • Links
    • Images
    • Lists
    • Tables
    • Responsive images and media

    Forms

    • Forms and inputs
    • Grouping form controls
    • Form validation and submission

    Structure and accessibility

    • Semantic HTML
    • Keyboard and screen-reader access
    • Disclosure with details
    • Project: your profile page
    HTML

    Content and media · Lesson 9 of 16

    Responsive images and media

    picture, audio, video and text alternatives.

    8 minutes1 games

    picture selects an image source using media conditions, with img providing fallback and alternative text. Audio and video need controls, and spoken video needs captions and an appropriate transcript. srcset and sizes help the browser choose an image resolution for its displayed size.

    HTML
    <picture>
      <source media="(min-width: 700px)" srcset="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='150'%3E%3Crect width='600' height='150' fill='teal'/%3E%3C/svg%3E">
      <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='150'%3E%3Crect width='240' height='150' fill='coral'/%3E%3C/svg%3E" alt="" width="240" height="150">
    </picture>
    <p>Resize the preview to switch the decorative image.</p>
    ToolUse

    controls

    Playback controls

    track kind="captions"

    Captions for speech and sound

    loading="lazy"

    Defer offscreen images

    Important

    Do not force automatic audio playback. Exercise media files are placeholders; supply real assets to test playback and captions.

    Interview question

    Are video controls enough for accessible video?

    Exercise

    Create a video with controls, a lesson.mp4 source and an English captions track.

    HTML

    Learn more from

    • MDN: HTML referencedeveloper.mozilla.org
    • web.dev: audio-videoweb.dev

    Played 0 of 1 games

    Sign in to save your progress and earn XP.

    PreviousTablesNextForms and inputs
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.