Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLSourceElement

HTMLSourceElement

TheHTMLSourceElement interface provides special properties (beyond the regularHTMLElement object interface it also has available to it by inheritance) for manipulating<source> elements.

EventTarget Node Element HTMLElement HTMLSourceElement

Instance properties

Inherits properties from its parent,HTMLElement.

HTMLSourceElement.height

A number that reflects theheight HTML attribute, indicating the height of the image resource in CSS pixels. The property has a meaning only if the parent of the current<source> element is a<picture> element.

HTMLSourceElement.media

A string reflecting themedia HTML attribute, containing the intended type of the media resource.

HTMLSourceElement.sizes

A string representing image sizes between breakpoints

HTMLSourceElement.src

A string reflecting thesrc HTML attribute, containing the URL for the media resource. TheHTMLSourceElement.src property has a meaning only when the associated<source> element is nested in a media element that is a<video> or an<audio> element. It has no meaning and is ignored when it is nested in a<picture> element.

Note:If thesrc property is updated (along with any siblings), the parentHTMLMediaElement'sload method should be called when done, since<source> elements are not re-scanned automatically.

HTMLSourceElement.srcset

A string reflecting thesrcset 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.

HTMLSourceElement.type

A string reflecting thetype HTML attribute, containing the type of the media resource.

HTMLSourceElement.width

A number that reflects thewidth HTML attribute, indicating the width of the image resource in CSS pixels. The property has a meaning only if the parent of the current<source> element is a<picture> element.

Instance methods

No specific method; inherits methods from its parent,HTMLElement.

Specifications

Specification
HTML
# htmlsourceelement

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp