<source> tag could work well in all media tags e.g <img>, <video>, <audio> and so on?

If audio tag and video tag works well with a nested source tag, so it could work well in all media tags like img tag and so on?

Lesson: https://www.codecademy.com/courses/learn-html/lessons/semantic-html/exercises/audio-and-attributes

Great day.

The <source> element is used inside a <picture> element to indicate different versions of the same image (perhaps of different size). It is not used with just the <img> element, but must be contained by a parent.


1 Like

Bit confused on whether to use ‘src’ attribute or

Would you only use source then for multiple versions of the same media and all other times (basic html) it would be;
<video/audio src=“xyz” controls>not supported</video/audio>

Each codec version will have its own source, so use src for each one.

1 Like