em scope in @media and @container
Am I remembering correctly that in an @media query, using ems or rems e.g.
but within a container query
if youve changed the containers font-size
I do remember Container queries: are "em" units computed using container ems or contained ems? about the @container spec that
- the @media is not looking at your
- in @container
@media (min-width: 50rem) or @media (min-width: 50em) is referring the browsers font-size, even if you've changed your html font-size to something like 62.5% , its still using 1rem = 16px and 1em=16px? but within a container query
@container(min-width: 50rem) or @container(min-width: 50em) rem is referring to what youve defined as your root font-size (so if you've changed your :root {font-size: 62.5%;} then a container query in rem would be calculating/resolving 1rem=10px.if youve changed the containers font-size
.container {font-size: 32px" the container query would be calculating/resolving 1em=32px ?I do remember Container queries: are "em" units computed using container ems or contained ems? about the @container spec that
1em looks at the containers font-size but want to confirm:- the @media is not looking at your
:root {font-size: ...}, its looking at the browsers root (which can either be 16px or what the user sets as their preferred font size) - in @container
1rem is looking at what youve defined in your :root {font-size: ...} 