Skip to main content

Day 79 of 100DaysOfSpec, 4.7 Embedded content (img element)

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading 4.7 Embedded content

4.7.1 The img element

This section is going to take me daaaaays to read.

“An img element represents an image.”

Besides global attributes, can have these attributes set:

  • alt

  • src

  • cross origin (handling of cross origin src requests; CORS attribute)

  • usemap (for image maps, remember those?)

  • ismap (is it a server-side image map?)

  • width

  • height

  • Self-closing tag.

  • Can be considered interactive content if has usemap attribute

  • Can’t be used for layout or transparency hacks (cough IE6).

  • The img element has these states:

    • Unavailable
    • Partially available
    • Completely available: “at least the image dimensions are available”
    • Broken: can’t even decode to get image dimensions
  • Even an img element that is partially available is “said to be” available, which I presume has implications for scripts that check whether the image loaded. Which could be not what you want if you’re doing dimension work with JS. This is just me wondering out loud, I may not be interpreting something correctly.

  • If scripting is turned on / available in the browsing context, the user agent (browser, etc) HAS to retrieve images immediately. Otherwise the UA could choose when to obtain the image, immediately or on demand.

  • On-demand-loaders can only make changes to the image when it’s in the “unavailable state” and has a src attribute.


My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.