html5 - Media queries PX vs EM vs REM -
can explain why media queries break when converting them px ems
in body of document, have included following rule font-size: 62.5%, therefore assume convert media query 650px 65em? changing media queries ems breaks layout
as alternative, can convert media query rems pixel fallback ?? said, have no idea how
@media screen , (min-width: 650px) { body { font-size: 62%; background-color: #364759; background-repeat: repeat-x; background: url("bg.gif"); } #wrapper, footer { width: 80%; max-width: 1050px; margin: 0 auto; } } // end media query many thanks, p
section 1.3 of media queries spec says:
relative units in media queries based on initial value, means units never based on results of declarations. example, in html, em unit relative initial value of font-size, defined user agent or user’s preferences, not styling on page.
similarly, section 2 says:
unless feature explicitly specifies affects resolution of media queries, never necessary apply style sheet in order evaluate expressions.
so font-size: 62.5% rule has no effect regards media queries, , 1em still 16px, not 10px.
the reason things way doing otherwise cause loops, css cannot deal with. try think of example if didn't have rule:
body { font-size: 10000px; } @media (min-width: 1em) { body { font-size: 1px; } } 1em gigantic, media query match, 1em small, media query wouldn't match, 1em gigantic, so...
Comments
Post a Comment