CSS fonts rem trick: 62.5% or 6.25%

后端 未结 3 1555
忘掉有多难
忘掉有多难 2021-01-13 13:31

I would like to use font sizing with REM and on internet I found following trick:

html { font-size: 62.5%; } 
body { font-size: 1.4rem; } /* =14px */
h1   {          


        
3条回答
  •  滥情空心
    2021-01-13 14:11

    You can also use pixels - the default font-size is 16px by default, setting 10px as a base allows you to use rems whereby 1rem = 10px because the root is set as 10px.

    html { font-size: 10px}
    body { font-size: 1.4rem; } /* =14px */
    h1   { font-size: 2.4rem; } /* =24px */
    

提交回复
热议问题