About Lesson
HTML provides several elements and attributes for incorporating multimedia content into web pages. Here are the commonly used HTML multimedia elements:
<img>
Element:
The<img>
element is used to display images on a web page. It supports various image formats such as JPEG, PNG, GIF, and SVG. Example:
<img src="image.jpg" alt="Description of the image">
<audio>
Element:
The<audio>
element is used to embed audio content on a web page. It supports various audio formats such as MP3, WAV, and Ogg. Example:
<audio src="audio.mp3" controls></audio>
<video>
Element:
The<video>
element is used to embed video content on a web page. It supports various video formats such as MP4, WebM, and Ogg. Example:
<video src="video.mp4" controls></video>
<source>
Element:
The<source>
element is used within<audio>
or<video>
elements to specify multiple sources of media content. This allows the browser to choose the appropriate source based on compatibility. Example:
<video controls>
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
<source src="video.ogg" type="video/ogg">
</video>
<iframe>
Element:
The<iframe>
element is used to embed external content, including multimedia, from other websites. It is commonly used for embedding videos from platforms like YouTube or Vimeo. Example:
<iframe src="https://www.youtube.com/embed/your-video-id" frameborder="0" allowfullscreen></iframe>
<embed>
Element:
The<embed>
element is used to embed external multimedia content, such as audio or video, directly into a web page. Example:
<embed src="audio.mp3" type="audio/mpeg">
These elements provide a variety of options for embedding and displaying multimedia content in HTML. It’s important to consider the compatibility of different formats and provide fallback options for unsupported browsers or devices.
Common Audio Formats
Format | File | Description |
---|---|---|
MIDI | .mid .midi | MIDI (Musical Instrument Digital Interface). Main format for all electronic music devices like synthesizers and PC sound cards. MIDI files do not contain sound, but digital notes that can be played by electronics. Plays well on all computers and music hardware, but not in web browsers. |
RealAudio | .rm .ram | RealAudio. Developed by Real Media to allow streaming of audio with low bandwidths. Does not play in web browsers. |
WMA | .wma | WMA (Windows Media Audio). Developed by Microsoft. Plays well on Windows computers, but not in web browsers. |
AAC | .aac | AAC (Advanced Audio Coding). Developed by Apple as the default format for iTunes. Plays well on Apple computers, but not in web browsers. |
WAV | .wav | WAV. Developed by IBM and Microsoft. Plays well on Windows, Macintosh, and Linux operating systems. Supported by HTML. |
Ogg | .ogg | Ogg. Developed by the Xiph.Org Foundation. Supported by HTML. |
MP3 | .mp3 | MP3 files are actually the sound part of MPEG files. MP3 is the most popular format for music players. Combines good compression (small files) with high quality. Supported by all browsers. |
MP4 | .mp4 | MP4 is a video format, but can also be used for audio. Supported by all browsers. |
Join the conversation