Table of Contents

Class HTMLSourceElement

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The HTMLSourceElement interface provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating {{htmlelement("source")}} elements.

[Value("HTMLSourceElement")]
public class HTMLSourceElement : HTMLElement
Inheritance
HTMLSourceElement
Inherited Members

Remarks

-The HTML element implementing this interface: source.
-The HTML DOM APIs of the elements that can contain a {{HTMLElement("source")}} element: HTMLVideoElement, HTMLAudioElement, HTMLPictureElement.

See also on MDN

Constructors

HTMLSourceElement()

public HTMLSourceElement()

Properties

Height

The height property of the HTMLSourceElement interface is a non-negative number indicating the height of the image resource in CSS pixels.

[Value("height")]
public ulong Height { get; set; }

Property Value

ulong

A non-negative number indicating the height of the image resource in CSS pixels.

Remarks

The property has an effect only if the parent of the current source element is a picture element.

It reflects the height attribute of the source element.

-Height
-Height
-Height
-Height
-Height
-Height

See also on MDN

Media

The media property of the HTMLSourceElement interface is a string representing the intended destination medium for the resource. The value is a media query, which is a comma separated list of media-types, media-features, and logical operators.

[Value("media")]
public string Media { get; set; }

Property Value

string

A string.

Remarks

It reflects the media attribute of the source element.

-Type
-Sizes
-Src
-Srcset
-source
-picture
-audio
-video
-Using media queries

See also on MDN

Sizes

The sizes property of the HTMLSourceElement interface is a string representing a list of one or more sizes, representing sizes between breakpoints, to which the resource applies.

[Value("sizes")]
public string Sizes { get; set; }

Property Value

string

A string.

Remarks

It reflects the sizes attribute of the source element.

-Sizes
-Media
-Type
-Src
-Srcset
-source
-picture
-audio
-video

See also on MDN

Src

The src property of the HTMLSourceElement interface is a string indicating the URL of a media resource to use as the source for the element.

[Value("src")]
public string Src { get; set; }

Property Value

string

A string; the URL of a source resource to use in the element.

Remarks

It reflects the src attribute of the source element nested in an audio or video element. It has no meaning and is ignored when it is nested in a picture element.

-Type
-Srcset
-Media
-Sizes
-source
-audio
-video

See also on MDN

Srcset

The srcset property of the HTMLSourceElement interface is a string containing a comma-separated list of candidate images.

[Value("srcset")]
public string Srcset { get; set; }

Property Value

string

A string.

Remarks

Each candidate image includes the URL of an image resource to use as the source for the element and optionally a descriptor indicating the circumstances in which the image should be used. The descriptor is either a number followed by 'w', indicating the element width, or a number followed by 'x', indicating the device pixel density.

It reflects the srcset attribute of the {{HTMLElement("source")}} element nested in a {{htmlelement("picture")}} element. It has no meaning and is ignored when it is nested in an {{htmlelement("audio")}} or {{htmlelement("video")}} element, which use the Src attribute instead.

-Type
-Src
-Media
-Sizes
-source
-picture

See also on MDN

Type

The type property of the HTMLSourceElement interface is a string representing the {{glossary("MIME type")}} of the media resource.

[Value("type")]
public string Type { get; set; }

Property Value

string

A string.

Remarks

Width

The width property of the HTMLSourceElement interface is a non-negative number indicating the width of the image resource in CSS pixels.

[Value("width")]
public ulong Width { get; set; }

Property Value

ulong

A non-negative number indicating the width of the image resource in CSS pixels.

Remarks

The property has an effect only if the parent of the current source element is a picture element.

It reflects the width attribute of the source element.

-Width
-Width
-Width
-Width
-Width
-Width

See also on MDN