HtmlImageElement Class
https://html.spec.whatwg.org/multipage/embedded-content.html#htmlimageelement
public sealed class HtmlImageElement : HtmlElement- Inheritance
HtmlElementHtmlImageElement
Properties
| Name | Description |
|---|---|
| Align | Gets or sets the value of the align content attribute. |
| Alt | Gets or sets the value of the alt content attribute. |
| Border | Gets or sets the value of the border content attribute. |
| Complete | https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete |
| Controls | Gets or sets a value indicating whether the element has the controls content attribute. |
| CrossOrigin | Gets or sets the value of the crossorigin content attribute, limited to the known values (the canonical keyword, or the default value). |
| CurrentSrc | Gets the URL of the current request (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc). |
| Decoding | Gets or sets the value of the decoding content attribute, limited to the known values (the canonical keyword, or the default value). |
| FetchPriority | Gets or sets the value of the fetchpriority content attribute, limited to the known values (the canonical keyword, or the default value). |
| Height | Gets or sets the value of the height content attribute. |
| Hspace | Gets or sets the value of the hspace content attribute. |
| IsMap | Gets or sets a value indicating whether the element has the ismap content attribute. |
| Loading | Gets or sets the value of the loading content attribute, limited to the known values (the canonical keyword, or the default value). |
| LongDesc | Gets or sets the longdesc content attribute, as a URL resolved against the base URL of the document. |
| Lowsrc | Gets or sets the lowsrc content attribute, as a URL resolved against the base URL of the document. |
| Name | Gets or sets the value of the name content attribute. |
| NaturalHeight | Gets the intrinsic height of the image in CSS pixels (0 when the image is not available). |
| NaturalWidth | 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. |
| ReferrerPolicy | Gets or sets the value of the referrerpolicy content attribute, limited to the known values (the canonical keyword, or the default value). |
| Sizes | Gets or sets the value of the sizes content attribute. |
| Src | Gets or sets the src content attribute, as a URL resolved against the base URL of the document. |
| Srcset | Gets or sets the value of the srcset content attribute. |
| UseMap | Gets or sets the value of the usemap content attribute. |
| Vspace | Gets or sets the value of the vspace content attribute. |
| Width | Gets or sets the value of the width content attribute. |
| X | 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. |
| Y | 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). |
Align
HtmlElements.g.csGets 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; }Property value
See also
Border
HtmlElements.g.csGets or sets the value of the border content attribute.
public string Border { get; set; }Complete
ImageLoading.cshttps://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
public bool Complete { get; }Property value
See also
Controls
HtmlElements.g.csGets or sets a value indicating whether the element has the controls content attribute.
public bool Controls { get; set; }Property value
See also
CrossOrigin
HtmlElements.g.csGets 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; }Property value
See also
CurrentSrc
ImageLoading.csGets the URL of the current request (https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc).
public string CurrentSrc { get; }Property value
See also
Decoding
HtmlElements.g.csGets 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; }Property value
See also
FetchPriority
HtmlElements.g.csGets 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; }Property value
See also
Height
HtmlElements.g.csGets or sets the value of the height content attribute.
public uint Height { get; set; }Property value
See also
Hspace
HtmlElements.g.csGets or sets the value of the hspace content attribute.
public uint Hspace { get; set; }IsMap
HtmlElements.g.csGets or sets a value indicating whether the element has the ismap content attribute.
public bool IsMap { get; set; }Property value
See also
Loading
HtmlElements.g.csGets 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; }Property value
See also
LongDesc
HtmlElements.g.csGets or sets the longdesc content attribute, as a URL resolved against the base URL of the document.
public string LongDesc { get; set; }Lowsrc
HtmlElements.g.csGets 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.csGets the intrinsic height of the image in CSS pixels (0 when the image is not available).
public uint NaturalHeight { get; }Property value
See also
NaturalWidth
ImageLoading.csGets 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; }Property value
See also
ReferrerPolicy
HtmlElements.g.csGets 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; }Sizes
HtmlElements.g.csGets or sets the value of the sizes content attribute.
public string Sizes { get; set; }Property value
See also
Gets or sets the src content attribute, as a URL resolved against the base URL of the document.
public string Src { get; set; }Property value
See also
Srcset
HtmlElements.g.csGets or sets the value of the srcset content attribute.
public string Srcset { get; set; }Property value
See also
UseMap
HtmlElements.g.csGets or sets the value of the usemap content attribute.
public string UseMap { get; set; }Property value
See also
Vspace
HtmlElements.g.csGets or sets the value of the vspace content attribute.
public uint Vspace { get; set; }Width
HtmlElements.g.csGets or sets the value of the width content attribute.
public uint Width { get; set; }Property value
See also
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
| Name | Description |
|---|---|
| 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.csCreates 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
documentDocument- The document of the element (the associated document of the current global object).
widthuint?- The value of the width attribute, or null.
heightuint?- The value of the height attribute, or null.
Returns
HtmlImageElement The new element.
See also
Decode()
ImageLoading.csReturns 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()