The question about rem

I wrote two css,: one is to be used when the maximum width is 700px, the other is to be used when the minimum width is 701px, and both css files are in rem units. And according to the articles I read on the Internet, at the beginning of the css file, I defined the fontsize size of html,body as 10px, and then set the font size of other element classes to rem units. On the PC side, I think it"s easy to understand, that is, relative to 10px.1.5 rem is 15px pixel. On the mobile side, I set the same parameters as pc, and the font size is 1.3rem, but sometimes when I set some margins, I set 4remline 5rem5, but the effect is still not obvious, is it best for rem to be used only in fonts, and it is best not to use it in other attribute settings?

Mar.03,2021

you said it the other way around. Fonts generally don't use rem, and use px, directly. It's just that you need to distinguish font sizes under different dpr according to the dpr of the device

.

as for other properties, you can use rem.

check whether you have added viewport

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

rem has to cooperate with media query. Have you set up media query

Menu