files/en-us/web/api/htmlsourceelement/index.md
{{APIRef("HTML DOM")}}
The HTMLSourceElement interface provides special properties (beyond the regular {{domxref("HTMLElement")}} object interface it also has available to it by inheritance) for manipulating {{htmlelement("source")}} elements.
{{InheritanceDiagram}}
Inherits properties from its parent, {{domxref("HTMLElement")}}.
{{domxref("HTMLSourceElement.height")}}
height HTML attribute, indicating the height of the image resource in CSS pixels. The property has a meaning only if the parent of the current {{HTMLElement("source")}} element is a {{HTMLElement("picture")}} element.{{domxref("HTMLSourceElement.media")}}
media HTML attribute, containing the intended type of the media resource.{{domxref("HTMLSourceElement.sizes")}}
{{domxref("HTMLSourceElement.src")}}
: A string reflecting the src HTML attribute, containing the URL for the media resource. The {{domxref("HTMLSourceElement.src")}} property has a meaning only when the associated {{HTMLElement("source")}} element is nested in a media element that is a {{htmlelement("video")}} or an {{htmlelement("audio")}} element. It has no meaning and is ignored when it is nested in a {{HTMLElement("picture")}} element.
[!NOTE] If the
srcproperty is updated (along with any siblings), the parent {{domxref("HTMLMediaElement")}}'sloadmethod should be called when done, since<source>elements are not re-scanned automatically.
{{domxref("HTMLSourceElement.srcset")}}
srcset HTML attribute, containing a list of candidate images, separated by a comma (',', U+002C COMMA). A candidate image is a URL followed by a 'w' with the width of the images, or an 'x' followed by the pixel density.{{domxref("HTMLSourceElement.type")}}
type HTML attribute, containing the type of the media resource.{{domxref("HTMLSourceElement.width")}}
width HTML attribute, indicating the width of the image resource in CSS pixels. The property has a meaning only if the parent of the current {{HTMLElement("source")}} element is a {{HTMLElement("picture")}} element.No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}.
{{Specifications}}
{{Compat}}