Responsive font size in CSS

前端 未结 30 2781
刺人心
刺人心 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 08:00

    I use these CSS classes, and they make my text fluid on any screen size:

    .h1-fluid {
        font-size: calc(1rem + 3vw);
        line-height: calc(1.4rem + 4.8vw);
    }
    
    .h2-fluid {
        font-size: calc(1rem + 2vw);
        line-height: calc(1.4rem + 2.4vw);
    }
    
    .h3-fluid {
        font-size: calc(1rem + 1vw);
        line-height: calc(1.4rem + 1.2vw);
    }
    
    .p-fluid {
        font-size: calc(1rem + 0.5vw);
        line-height: calc(1.4rem + 0.6vw);
    }
    

提交回复
热议问题