A Jolly Web Typesetting Adventure

Web Typography is broken: here’s how we can fix it

Thomas Bredin-Grey

Lead Front End Developer

Thick

Why should we care?

why

It’s about the users

How can we improve the traversability of content in a layout?

The web is 95% typography

We spend a lot of time setting type, but we don’t talk about it much

meetup
medium

Grids are one way we can bring structure to our type

Grids

The web is saturated with grid columns

To support type, we often want a baseline

example baseline grid

CSS line-height sucks.

It adds vertical space around text.
Isn’t this what margins are for?

The Spooky Box

The dimensions of type on the web are defined by a combination of font-size and line-height - there’s no concept of a typographic baseline.

Developers and designers speak different languages

There isn't any typographic basis for the space that line-height creates.

A typographic spec

A typographic spec

Notable tools

tools

Compass Vertical Rhythm

You had one job

compass example

Sassline

Modern, but not entirely natural

sassline example

Something new

dog

Best practises

  • Type is best set in rems or ems. Depending on context
  • Pixels aren’t flexible (literally)
  • Line height is best expressed unitless
  • Tool output should be predictable
  • Tool output should leave predictable options for workarounds

Introducing

MegaType

Megatype

Web typography without the Spooky Box

Demo time

Breakpoint config

Breakpoint config

Fluid type / Baseline snap

Scaling / Baseline
  • Scale type smoothly between breakpoints
  • Snap all type to a baseline grid

Provide a cap-height

cap-height

Initialise!

cap-height
  • Optionally: set a container based on max widths

Set your type

typeset
typeset

Install as a package

typeset

The future

future

Is our browser spec incomplete?

Better type control could be native

Well, it turns out a recommendation exists

https://www.w3.org/TR/REC-CSS2/fonts.html#descdef-cap-height

It’s up to us

End

Thomas Bredin-Grey
@tbredin

Slides:
http://talks.studiothick.com/web-typography/