What should be the units used in media queries. I think using pixels is not good.. Kindly advise thank you | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What should be the units used in media queries. I think using pixels is not good.. Kindly advise thank you

11th Jun 2020, 1:39 PM
reshabh jauhari
reshabh jauhari - avatar
3 Answers
0
Pixels should be used to set breakpoints with media queries. Why do you believe they are not good?
11th Jun 2020, 6:17 PM
JME
0
JME i believe that because pixel size is different for all devices for same size of screen there can be different resolutions and therefore different size of pixels
11th Jun 2020, 8:39 PM
reshabh jauhari
reshabh jauhari - avatar
0
You can use additional query filters like ( min-resolution: 200dpi ) & ( -webkit-min-device-pixel-ratio: 1.25 ) to handle situations like that. For most people px's are fine and will handle almost all cases. vw/vh/% are also helpful ways to avoid media queries
11th Jun 2020, 9:39 PM
JME