3 ms·
> The answer is why the hell am I being forced to figure this out? Because the decision is made before CSS loads and is parsed, so the browser doesn’t know any
by afavour 6y ago
> The answer is why the hell am I being forced to figure this out?
Because the decision is made before CSS loads and is parsed, so the browser doesn’t know any of this.
Don’t get me wrong, this frustrates me endlessly as well, but the reasons for it are clear. Delaying until CSS has been parsed would slow down image loading.
- pupppet 6y agoIf we can lazy-load the image until the image is in view, we can lazy-load until its container width has been determined. I get there’s reasoning for how things behave as they do, my point is really we’re in this position due to lack of foresight by WHATWG/W3C.
- charrondev 6y agoFor images where you don’t declare the ratio it can’t completely determine the width until the image is loaded.
- pupppet 6y agoIf you don't declare the width/height or intrinsicsize, then you've just opted out of loading an image by its container size, pretty simple.