HtmlImageElement Class

https://html.spec.whatwg.org/multipage/embedded-content.html#htmlimageelement

public sealed class HtmlImageElement : HtmlElement
Inheritance
HtmlElement HtmlImageElement

Properties

NameDescription
AlignGets or sets the value of the align content attribute.
AltGets or sets the value of the alt content attribute.
BorderGets or sets the value of the border content attribute.
Completehttps://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
ControlsGets or sets a value indicating whether the element has the controls content attribute.
CrossOriginGets or sets the value of the crossorigin content attribute, limited to the known values (the canonical keyword, or the default value).
CurrentSrcGets the URL of the current request (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc).
DecodingGets or sets the value of the decoding content attribute, limited to the known values (the canonical keyword, or the default value).
FetchPriorityGets or sets the value of the fetchpriority content attribute, limited to the known values (the canonical keyword, or the default value).
HeightGets or sets the value of the height content attribute.
HspaceGets or sets the value of the hspace content attribute.
IsMapGets or sets a value indicating whether the element has the ismap content attribute.
LoadingGets or sets the value of the loading content attribute, limited to the known values (the canonical keyword, or the default value).
LongDescGets or sets the longdesc content attribute, as a URL resolved against the base URL of the document.
LowsrcGets or sets the lowsrc content attribute, as a URL resolved against the base URL of the document.
NameGets or sets the value of the name content attribute.
NaturalHeightGets the intrinsic height of the image in CSS pixels (0 when the image is not available).
NaturalWidthGets the natural width of the image (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth): the width of the image data divided by the pixel density of the selected source, or 0 when the image is not available.
ReferrerPolicyGets or sets the value of the referrerpolicy content attribute, limited to the known values (the canonical keyword, or the default value).
SizesGets or sets the value of the sizes content attribute.
SrcGets or sets the src content attribute, as a URL resolved against the base URL of the document.
SrcsetGets or sets the value of the srcset content attribute.
UseMapGets or sets the value of the usemap content attribute.
VspaceGets or sets the value of the vspace content attribute.
WidthGets or sets the value of the width content attribute.
XGets the horizontal position of the image (https://drafts.csswg.org/cssom-view/#dom-htmlimageelement-x): the x-coordinate of the left border edge of its first box relative to the initial containing block origin, ignoring the transforms, or 0 when it does not generate a box.
YGets the vertical position of the image (https://drafts.csswg.org/cssom-view/#dom-htmlimageelement-y): the y-coordinate of the top border edge of its first box (see HtmlImageElement.X).

Gets or sets the value of the align content attribute.

public string Align { get; set; }

Gets or sets the value of the alt content attribute.

public string Alt { get; set; }

Gets or sets the value of the border content attribute.

public string Border { get; set; }

https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete

public bool Complete { get; }

Gets or sets a value indicating whether the element has the controls content attribute.

public bool Controls { get; set; }

Gets or sets the value of the crossorigin content attribute, limited to the known values (the canonical keyword, or the default value).

public string? CrossOrigin { get; set; }

CurrentSrc

ImageLoading.cs

Gets the URL of the current request (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc).

public string CurrentSrc { get; }

Gets or sets the value of the decoding content attribute, limited to the known values (the canonical keyword, or the default value).

public string Decoding { get; set; }

FetchPriority

HtmlElements.g.cs

Gets or sets the value of the fetchpriority content attribute, limited to the known values (the canonical keyword, or the default value).

public string FetchPriority { get; set; }

Gets or sets the value of the height content attribute.

public uint Height { get; set; }

Gets or sets the value of the hspace content attribute.

public uint Hspace { get; set; }

Gets or sets a value indicating whether the element has the ismap content attribute.

public bool IsMap { get; set; }

Gets or sets the value of the loading content attribute, limited to the known values (the canonical keyword, or the default value).

public string Loading { get; set; }

Gets or sets the longdesc content attribute, as a URL resolved against the base URL of the document.

public string LongDesc { get; set; }

Gets or sets the lowsrc content attribute, as a URL resolved against the base URL of the document.

public string Lowsrc { get; set; }

Gets or sets the value of the name content attribute.

public string Name { get; set; }

NaturalHeight

ImageLoading.cs

Gets the intrinsic height of the image in CSS pixels (0 when the image is not available).

public uint NaturalHeight { get; }

NaturalWidth

ImageLoading.cs

Gets the natural width of the image (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth): the width of the image data divided by the pixel density of the selected source, or 0 when the image is not available.

public uint NaturalWidth { get; }

ReferrerPolicy

HtmlElements.g.cs

Gets or sets the value of the referrerpolicy content attribute, limited to the known values (the canonical keyword, or the default value).

public string ReferrerPolicy { get; set; }

Gets or sets the value of the sizes content attribute.

public string Sizes { get; set; }

Gets or sets the src content attribute, as a URL resolved against the base URL of the document.

public string Src { get; set; }

Gets or sets the value of the srcset content attribute.

public string Srcset { get; set; }

Gets or sets the value of the usemap content attribute.

public string UseMap { get; set; }

Gets or sets the value of the vspace content attribute.

public uint Vspace { get; set; }

Gets or sets the value of the width content attribute.

public uint Width { get; set; }

Gets the horizontal position of the image (https://drafts.csswg.org/cssom-view/#dom-htmlimageelement-x): the x-coordinate of the left border edge of its first box relative to the initial containing block origin, ignoring the transforms, or 0 when it does not generate a box.

public int X { get; }

Gets the vertical position of the image (https://drafts.csswg.org/cssom-view/#dom-htmlimageelement-y): the y-coordinate of the top border edge of its first box (see HtmlImageElement.X).

public int Y { get; }

Methods

NameDescription
Create(Document, uint?, uint?)Creates an img element (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-image).
Decode()Returns a task that completes when the image is available and decoded (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode), or fails with an EncodingError when the image cannot be loaded or decoded, the current request changes or the document is not fully active. The pixels are decoded by the rendering backend of the browsing context (BrowsingContextOptions.RenderingBackend); without backend, nothing is decoded and an available image succeeds.

Create(Document, uint?, uint?)

ImageLoading.cs

Creates an img element (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-image).

public static HtmlImageElement Create(Document document, uint? width = null, uint? height = null)

Parameters

document Document
The document of the element (the associated document of the current global object).
width uint?
The value of the width attribute, or null.
height uint?
The value of the height attribute, or null.

Returns

HtmlImageElement The new element.

See also

Returns a task that completes when the image is available and decoded (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode), or fails with an EncodingError when the image cannot be loaded or decoded, the current request changes or the document is not fully active. The pixels are decoded by the rendering backend of the browsing context (BrowsingContextOptions.RenderingBackend); without backend, nothing is decoded and an available image succeeds.

public Task Decode()