Solving the problem of mobile terminal adaptation fonts:
Tell me what I know
General text size
Taking into account the bitmap information of the font, generally the text size will use the equivalent of 16px20px24px,
If you specify the text size with rem, values such as 21px and 19px will be generated, which will result in ugly fonts, burrs, and even black blocks , so Use px units to set, and then set different font-size according to the resolution of the device. Since most of the device-independent pixels on the mobile terminal will not differ too much, you can set different dpr according to the resolution of the device. Make settings.
may also require screen scaling, and considering that this type of text is generally larger, if exceeds 30px, you can also use rem to set the font.
Note:
Using Taobao's flexible scheme layout will not automatically convert your set unit px into rem. Of course, it can be achieved with a plug-in.
The mobile shopping solution will dynamically generate the initial-scale,maximum-scale,minimum value, use rem for layout width and height, and then html tag settings font-size, and use fone-size to control rem Width and height, and use Device pixel ratio to set the dpr来适配screen density display of different mobile devices flexible.js source code
This is the documentation of lib.flexible, you can check it out.
If you don’t want to change the dpr, you can specify the value of dpr in the meta tag, so that the problem you mentioned will not occur
Solving the problem of mobile terminal adaptation fonts:
Tell me what I know
General text size
Taking into account the bitmap information of the font, generally the text size will use the equivalent of
16px
20px
24px
,If you specify the text size with
rem
, values such as21px
and19px
will be generated, which will result in ugly fonts, burrs, and even black blocks , so Usepx
units to set, and then set differentfont-size
according to the resolution of the device. Since most of the device-independent pixels on the mobile terminal will not differ too much, you can set differentdpr
according to the resolution of the device. Make settings.Title text
may also require screen scaling, and considering that this type of text is generally larger, if exceeds
30px
, you can also userem
to set the font.Note:
Using Taobao's
flexible
scheme layout will not automatically convert your set unitpx
intorem
. Of course, it can be achieved with a plug-in.The mobile shopping solution will dynamically generate the
initial-scale,maximum-scale,minimum
value, userem
for layout width and height, and thenhtml
tag settingsfont-size
, and usefone-size
to controlrem
Width and height, and use Device pixel ratio to set thedpr来适配
screen density display of different mobile devicesflexible.js source code