2018-01-10 15:23:04 UTC
If someone is on a slow internet connection, and the page they are loading/reading includes an image, the layout of the page will often shift when the image starts to load (aka page reflow).
This is often due to the image being set to a percentage based `width` in CSS, and the height being set to `auto` - so the browser has to wait for the image to start downloading to calculate the size of the image.
However, web developers can provide width/height attributes in the HTML as well, and while CSS overrides these values when rendering, the browser could use the HTML attributes to do an initial height calculation.
As a work around, web developers currently use solutions like the following to avoid page reflow:
It should also be noted that Firefox will show the alt text while the image is loading; and while I'm more focused on the image changing size, some developers find the alt text is also a problem while the page is loading (I've met some who would leave the alt attribute blank because of it - which is annoying, because it's very important).
This is following on from a brief discussion with Tantek about the loading of images in browsers:
Where they also suggested these resources as being useful:
And here are the bug reports for Chrome and Safari: