Why can't I set the text size in rem units?

the questions encountered in today"s interview were not answered. According to the interviewer, the text set with rem will be smaller than that set with px. I can"t understand it all the time. I hope God can solve the problem.


I have never encountered such a situation.

This problem usually occurs because the font-size of html is written dead . Without using media-query dynamic change, the font will become smaller on the high-resolution screen, but this does not mean that cannot set the text size in rem units


fonts set with rem are also scaled according to the size of the screen on different devices, which are generally not needed. Fonts should look the same in different sizes and resolutions


I don't think there's anything wrong with using rem to set the text size. Think about it. If you want a set of codes to adapt to the phone end and the pad end, your phone side uses 12px, if you don't adapt to the rem setting font size on the pad end, the font you see is very small and seriously affects the user experience. Can you not use rem to set the font size


or you heard it wrong? Either the other party is wrong. I suggest you take a good look at the explanation about rem.


I think there should be some questions in the description of the landlord's question, and the interviewer should have a prerequisite here. For example, when the root node fontSize equals how much, the rem font is smaller than px.


the biggest problem with using rem to make fonts should be aliasing. If you insist that it is smaller than px, then I think it may be the problem of browser rounding and the fact that font-size values are not rounded. What I found in the actual project is that using rem to make the size of the picture will be deformed. For example: width:.22rem;height:.22rem; does not render a square on Android, it will squash and flatten.


setting the text size with rem is smaller than px, which is really new.
the main problems I encounter with rem are that due to the limitation of chrome's minimum font 12px, if the html font-size set by js calculation is less than 12px, then when setting margin,padding,height,width through rem, rem will convert according to 12px, which will be larger than you expected. Setting font-size is not affected by this


http://caibaojian.com/web-app. take a look at this article and introduce it in more detail!

Menu