Responsive font-size/weight

后端 未结 4 899
轻奢々
轻奢々 2021-02-04 21:35

I can make my images/divs responsive by using percentages.

How can I make the font-size responsive to different screen sizes?

4条回答
  •  -上瘾入骨i
    2021-02-04 22:19

    You can use CSS3 vh, vw,vmin and vmax new values for responsive font.

    1vw = 1% of viewport width

    1vh = 1% of viewport height

    1vmin = 1vw or 1vh, whichever is smaller

    1vmax = 1vw or 1vh, whichever is larger

    h1 {
    font-size: 5.9vw;
    }
    h2 {
    font-size: 3.0vh;
    }
    p {
    font-size: 2vmin;
    }
    

提交回复
热议问题