Responsive font size in CSS

前端 未结 30 3305
刺人心
刺人心 2020-11-22 07:23

I\'ve created a site using the Zurb Foundation 3 grid. Each page has a large h1:

30条回答
  •  面向向阳花
    2020-11-22 07:57

    You can use the viewport value instead of ems, pxs, or pts:

    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;
    }
    

    From CSS-Tricks: Viewport Sized Typography

提交回复
热议问题