midHTML5
What is the purpose of the <audio> and <video> tags?
Updated Apr 28, 2026
Short answer
To embed multimedia without requiring external plugins like Flash.
Deep explanation
These tags support multiple source files via the <source> tag to ensure cross-browser compatibility (e.g., MP4 vs WebM). They include attributes like controls, autoplay, and loop.
Real-world example
Self-hosting a promotional video on a landing page instead of using a third-party iframe.
Common mistakes
- Not providing fallback text for older browsers that don't support the tags.
Follow-up questions
- What is the 'poster' attribute in <video>?