Responsive font size in CSS

前端 未结 30 2775
刺人心
刺人心 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:03

    One way to solve the problem of the text to look good on both desktop and mobile/tablet is in fixing the text size to physical units like physical centimeters or inches, which don't depend on the screen PPI (points per inch).

    Based on this answer, below is the code I use at the end of the HTML document for a responsive font size:

    In the code above the items of a different class are assigned font sizes in physical units, as long as the browser/OS is configured correctly for the PPI of its screen.

    A physical-unit font is always not too large and not too small, so long as the distance to the screen is usual (book-reading distance).

提交回复
热议问题