What is the purpose of the <source> element within media content?

Learn web design with our comprehensive test guide. Improve your skills with flashcards and multiple choice questions. Each question includes hints and explanations. Get ready to ace your exam!

Multiple Choice

What is the purpose of the <source> element within media content?

Explanation:
The main idea is that the <source> element inside media content provides alternative formats of the same media so the browser can choose one it supports. Each source specifies a different file and its type, and the browser will try them in order until it finds a playable format. This makes playback more reliable across different browsers and devices, since not every browser supports every codec or container. For example, you might offer a MP4 version and a WebM version, and the browser will pick the first one it can play. If captions are needed, they’re added with a separate track element, not by the source element. Likewise, images use an img tag and CSS is linked with a link tag. Example: <video controls><source src="video.mp4" type="video/mp4"><source src="video.webm" type="video/webm"></video>.

The main idea is that the element inside media content provides alternative formats of the same media so the browser can choose one it supports. Each source specifies a different file and its type, and the browser will try them in order until it finds a playable format. This makes playback more reliable across different browsers and devices, since not every browser supports every codec or container. For example, you might offer a MP4 version and a WebM version, and the browser will pick the first one it can play. If captions are needed, they’re added with a separate track element, not by the source element. Likewise, images use an img tag and CSS is linked with a link tag. Example: .

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy