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.
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.
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
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.
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.
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
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
It reflects the type attribute of the source element.
-Src
-Srcset
-Media
-Sizes
-source
-picture
-audio
-video
-Media types found on the web
-Important MIME types for web developers
-Media Capabilities API
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.