Font scaling based on width of container

后端 未结 30 3041
面向向阳花
面向向阳花 2020-11-21 04:35

I\'m having a hard time getting my head around font scaling.

I currently have a website with a body font-size of 100%. 100% of what though? This seems t

30条回答
  •  终归单人心
    2020-11-21 05:32

    Try to use the fitText plugin, because Viewport sizes isn't the solution of this problem.

    Just add the library:

    
    

    And change font-size for correct by settings the coefficient of text:

    $("#text_div").fitText(0.8);
    

    You can set maximum and minimum values of text:

    $("#text_div").fitText(0.8, { minFontSize: '12px', maxFontSize: '36px' });
    

提交回复
热议问题