Responsive Typography

It appears that by using calc() and vw we can get responsive typography that scales perfectly between specific pixel values within a specific viewport range.

The problem with the common approach to responsive typography is that it is jumpy and requires a lot of media queries.

Viewport units are fluid but lack precise control over font-size.

Typically you might use a table like this to work out the range of font sizes across different resolutions.

Viewport units:1vw2vw3vw4vw5vw
Viewport sizefont-size in pixels

Looking at the table you can see there are many limitations. There is no way to scale between 16px and 36px for example over the given viewport sizes. That is a shame because this is the type of control designers expect (and should expect).

Imagine you want the smallest font-size to be 12 pixels and then once the device width is greater than 400px you want the font-size to gradually increase to 24px and stop scaling by the time the viewport reaches 800px. That is exactly what this demo does!

This is achieved by using viewport units in combination with calc().

More details here:

Get the SCSS mixin:

See all examples in the collection:

Read about it on Smashing: