<p>I've been studying advanced HTML, and, I am wondering this: In HTML5, why does the <code>&lt;source&gt;</code> tag use the <code>src</code> attribute in <code>&lt;video&gt;</code> and <code>&lt;audio&gt;</code> elements, but it uses the <code>srcset</code> in the <code>&lt;picture&gt;</code> element? Why can't it always use <code>src</code>?</p>

<language-design>
In HTML5, why does the `<source>` tag use the `src` attribute in `<video>` and `<audio>` elements, but it uses the `srcset` in a `<picture>` element?
CC BY-SA 4.0
2024-12-31T12:41:55.840Z
I don’t think `srcset=` existed back when `<audio>` and `<video>` were being defined.
user3840170
<p>At least as I read things, src is limited to a single target while srcset provides options based on the user's display.</p>
<p>It would, of course, have been possible for src to be used for both, but since the format differs it at least makes some sense.</p>

CC BY-SA 4.0
2024-12-30T00:25:55.530Z
2024-12-30T00:25:55.530Z
SoronelHaetir
CC BY-SA 4.0
2024-12-30T00:33:49.287Z
I don't think the question is asking what the difference between them is, but rather *why* the choice for `<picture>` didn't match the one for `<video>` several years earlier, or why it uses the same element name for essentially disjoint purposes (`<picture>` and `<video>` operate *very* differently!). This is presumably documented somewhere in minutes or mailing list archives. "It would, of course, have been possible for src to be used for both" — but, would it? That depends on the rationale.
Michael Homer
CC BY-SA 4.0
2024-12-30T00:39:11.807Z
And my answer remains: "They (src and srcset) have somewhat different behavior, so different tags are appropriate", even if in most cases only one URL is going to be provided for an image, not taking advantage of the customizability.
SoronelHaetir
CC BY-SA 4.0
2024-12-30T01:30:39.333Z
Ideally an answer here would have primary-source design rationale (specification text, WHATWG minutes), but even without that an answer that doesn't address why `<video>` and `<picture>` differ is not really engaging with the question. That src and srcset have different formats is a given, but why isn't the design multiple single-source elements `<source src="abc.png" ...><source src="def.webp" ...>`, as is done for video/audio? Why doesn't video use srcset? You say different tags are appropriate, but they specifically **didn't** use different tags for this! Why not? You can [edit] your answer
Michael Homer
# In HTML5, why does the `<source>` tag use the `src` attribute in `<video>` and `<audio>` elements, but it uses the `srcset` in a `<picture>` element?
Posted by: username_0 on 2024-12-29
I've been studying advanced HTML, and, I am wondering this: In HTML5, why does the  tag use the `src` attribute in  and  elements, but it uses the `srcset` in the  element? Why can't it always use `src`?
**Tags:** language-design
> **Comments:**
> **username_1**: I don’t think `srcset=` existed back when `<audio>` and `<video>` were being defined.  
---
## 1 answers
### Answer by username_2 on 2024-12-30. Score: -3
At least as I read things, src is limited to a single target while srcset provides options based on the user's display.

It would, of course, have been possible for src to be used for both, but since the format differs it at least makes some sense.
> **Comments:**
> **username_3** (2024-12-30): I don't think the question is asking what the difference between them is, but rather *why* the choice for `<picture>` didn't match the one for `<video>` several years earlier, or why it uses the same element name for essentially disjoint purposes (`<picture>` and `<video>` operate *very* differently!). This is presumably documented somewhere in minutes or mailing list archives. "It would, of course, have been possible for src to be used for both" — but, would it? That depends on the rationale.  
> **username_2** (2024-12-30): And my answer remains: "They (src and srcset) have somewhat different behavior, so different tags are appropriate", even if in most cases only one URL is going to be provided for an image, not taking advantage of the customizability.  
> **username_3** (2024-12-30): Ideally an answer here would have primary-source design rationale (specification text, WHATWG minutes), but even without that an answer that doesn't address why `<video>` and `<picture>` differ is not really engaging with the question. That src and srcset have different formats is a given, but why isn't the design multiple single-source elements `<source src="abc.png" ...><source src="def.webp" ...>`, as is done for video/audio? Why doesn't video use srcset? You say different tags are appropriate, but they specifically **didn't** use different tags for this! Why not? You can [edit] your answer  
---
