D
D
Dmitry2015-09-22 23:18:29
css
Dmitry, 2015-09-22 23:18:29

Should I use em or px in media queries?

I read a lot of articles on this topic, and was a little puzzled by a few questions. What are the pros of using relative units in media all format ( max-width: 40em )? What's better?
The strangest thing is that after testing a couple of examples and playing around with the values, it turned out that if I, for example, change the base font to 40px, why does the breakpoint turn out to be 800px, and not 1600px?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Therapyx, 2015-09-22
@Therapyx

EM or REM
https://j.eremy.net/confused-about-rem-and-em/

M
Mikhail Gozhiy, 2015-09-23
@bukinion

Of course em, more control over typography in cases where the user defines font sizes in settings or zooms.
There is an old article on the-ems-have-it-proportional-media-queries-ftw/
or an answer on the stack: switching-to-em-based-media-queries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question