HTML/HTML Media & Image

HTML Media (Audio & Video)

Updated on January 6, 2026
1 min read

What is HTML Media?

HTML Media is used to play sound and video on a web page without extra software.

Examples:

  • Music
  • Videos
  • Tutorials
  • Movies

HTML Audio Tag

Basic Syntax

<audio controls>
  <source src="song.mp3" type="audio/mpeg">
</audio>

Audio Tag Attributes

AttributeUse
controlsPlay / Pause buttons
autoplayPlays automatically
loopRepeat audio
mutedSound off

Example

<audio controls autoplay loop>
  <source src="music.mp3">
</audio>

HTML Video Tag

Basic Syntax

<video controls width="300">
  <source src="video.mp4" type="video/mp4">
</video>

Video Tag Attributes

AttributeUse
controlsVideo controls
autoplayAutoplay
loopRepeat
mutedNo sound
widthVideo width
heightVideo height
posterThumbnail image

Example

<video controls width="400" poster="thumb.jpg">
  <source src="movie.mp4">
</video>

Audio vs Video

AudioVideo
Sound onlySound + visuals
Uses <audio>Uses <video>

Supported Formats

Audio

  • MP3
  • WAV
  • OGG

Video

  • MP4
  • WebM
  • OGG

Important Tips

  • Always use controls
  • Use muted with autoplay
  • Use poster for better UI
HTML Media (Audio & Video) | HTML | Learn Syntax