The HTMLImageElement
interface provides special properties and methods for manipulating the layout and presentation of img
elements.
Documentation HTMLImageElement by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See:
Variables
Is a DOMString
that reflects the alt
HTML attribute, thus indicating fallback context for the image.
Is a DOMString
that is responsible for the width of the border surrounding the image. This is now deprecated and the CSS border
property should be used instead.
Returns a Boolean
that is true
if the browser has finished fetching the image, whether successful or not. It also shows true, if the image has no HTMLImageElement.src
value.
Is a DOMString
representing the CORS setting for this image element. See CORS settings attributes for further details.
read onlycurrentSrc:String
Returns a DOMString
representing the URL to the currently displayed image (which may change, for example in response to media queries).
Is a unsigned long
that reflects the height
HTML attribute, indicating the rendered height of the image in CSS pixels.
Is a Boolean
that reflects the ismap
HTML attribute, indicating that the image is part of a server-side image map.
read onlynaturalHeight:Int
Returns a unsigned long
representing the intrinsic height of the image in CSS pixels, if it is available; else, it shows 0
.
read onlynaturalWidth:Int
Returns a unsigned long
representing the intrinsic width of the image in CSS pixels, if it is available; otherwise, it will show 0
.
Is a DOMString
that reflects the src
HTML attribute, containing the full URL of the image including base URI.
Is a DOMString
reflecting the srcset
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.
Is a unsigned long
that reflects the width
HTML attribute, indicating the rendered width of the image in CSS pixels.