Media queries with rem units in Chrome?

后端 未结 3 1023
说谎
说谎 2021-01-06 07:55

Is it possible to use rem units in Chrome media queries?

rem units work flawlessly in Chrome, it just seems that they are not supported in

3条回答
  •  太阳男子
    2021-01-06 08:37

    After posting the answer below this question bugged me. I did a little more testing in Chrome with the site I'm working on. The post about rem's being a bug in Chrome is correct, they don't work, so I'm changing to pixels just for the media queries.

    *To answer your question, rems are working for me to adjust the height of a content area using media queries. It's how Chrome interperets browser width that seems to differ from Firefox, but that's not a rem based problem.

    Keep in mind, when I use rems and ems it is after setting font-size: 1em; or font-size: 16px; for html or body. I'm leaning towards sticking to font-size: 1em; on the html tag. That creates a default that works from whatever the user has set for a default font size, on whatever device they're using. Rem's are relative to the root value of 1em. That root value is given by the user's default font-size, so everything should scale according to the user's font size preference and be device/pixel-density independent.

    This means whether the user is using a "normal" 72 or 96 pixel/inch device, or a Retina (or other high pixel density screen) everything should look "relatively" the same from device to device.

提交回复
热议问题