Search code examples
htmlcssfluid-layout

How to implement fluid font size using pure CSS


I have text wrapped in <div>s, and would like to make the whole thing fluid including the font-size of the text, i.e. the text resizes itself in response to the size of the containing element.

I came across a Javasript + CSS solution, but just wondering if it is possible to do so with pure CSS?


Solution

  • Yes, look at CSS 3 media queries. You can provide different style rules depending on the viewport width. This includes altering the font size.