🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

HTML Media

Web FoundationsđŸŸĸ Free Lesson

Advertisement

HTML Media

Audio, video, images, SVG, and media accessibility.

Overview

HTML media elements embed audio, video, and graphics.

Key Concepts

  • Video — <video> with controls, sources, and tracks
  • Audio — <audio> with multiple sources
  • Images — <img> with responsive and lazy loading
  • SVG — Inline and external SVG graphics
  • Accessibility — Captions, transcripts, and alt text

Code Examples


<video controls width="640" height="360">
  <source src="video.mp4" type="video/mp4">
  <source src="video.webm" type="video/webm">
  <track src="captions.vtt" kind="captions" srclang="en" label="English">
  <track src="transcript.vtt" kind="descriptions" srclang="en" label="Transcript">
  <p>Your browser doesn't support HTML video. <a href="video.mp4">Download</a></p>
</video>


<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  <source src="audio.ogg" type="audio/ogg">
  <p>Your browser doesn't support HTML audio. <a href="audio.mp3">Download</a></p>
</audio>


<picture>
  <source media="(min-width: 800px)" srcset="large.jpg">
  <source media="(min-width: 400px)" srcset="medium.jpg">
  <img src="small.jpg" alt="Description of image" loading="lazy">
</picture>


<svg width="100" height="100" viewBox="0 0 100 100" aria-hidden="true">
  <circle cx="50" cy="50" r="40" fill="#007bff"/>
  <text x="50" y="55" text-anchor="middle" fill="white">42</text>
</svg>

Practice

Create a responsive media gallery with video, audio, and images.

Need Expert Web Development Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement