Back to Topics
HTML Media
What is HTML Media?
HTML Media allows you to integrate multimedia content like audio and video directly into your web pages. This makes your website more interactive and provides a richer experience for users.
Core Media Tags
- <video> — Used to embed video files (MP4, WebM).
- <audio> — Used to embed audio files (MP3, WAV).
Syntax
<video controls>
<source src="movie.mp4" type="video/mp4">
</video>
<audio controls>
<source src="song.mp3" type="audio/mpeg">
</audio>
Useful Attributes
- controls — Displays playback controls (Play, Pause, Volume).
- autoplay — Starts playing as soon as the page loads.
- loop — Automatically restarts the media when it ends.
- muted — Plays the media without sound by default.
View My Practice Work