How to calculate REM for type?

前端 未结 2 860
遇见更好的自我
遇见更好的自我 2020-12-13 21:48

How do I convert PX into REM for my type? I\'ve read Jonathan Snook\'s article about using REM, but he was using font-size:62.5%, which defaults to your font size to 10px (f

2条回答
  •  再見小時候
    2020-12-13 22:30

    if u just add this code to your style file

    html {
      font-size: 62.5%;
    }
    

    it will convert 1 rem=10px. Now you will be working 10px base. So

    body {
      font-size: 1.6 rem;
    }
    

    u will have font size 1.6*10=16 px.

提交回复
热议问题