How can browsers understand the em
unit when used in a responsive image?
<img alt="A giraffe" src="giraffe.jpg"
srcset="giraffe@1.5x.jpg 600w, giraffe@2x.jpg 800w, [etc.]"
sizes="(max-width: 40em) 40em">
This validates, and I'm not seeing warnings in browser consoles. But if the whole point of the image preloader is to fetch images before the CSS is downloaded and parsed, what does the browser use for em
?
Is it just its default font-size
that it applies to <html>
? Should I use rem
for clarity? Is there a difference between the two when the user zooms?
This isn't theoretical; I'm using em
in my media query breakpoints, and some images are constrained by a container sized for optimal line length (using em
, of course).
I checked the spec, but it's remarkably terse on the new responsive image features.