Michael Gearon

CSS Font Smoothing in Webkit and Firefox

Michael Gearon

Last updated on

CSS3 Pseudo Element

Using font smoothing can turn a horrible typeface to a beautiful one. The Webkit and Firefox browsers make the fonts look slightly thicker, using just two lines of CSS we can solve this problem.

Syntax

The default value for -moz-osx-font-smoothing is auto. This will work in Firefox using the -moz- prefix, and for it work in Opera, Safari and Chrome use the -webkit- prefix. This is not supported in any version of Internet Explorer or Edge.


body{
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; /* Default: auto */
}

Example of font smoothing in CSS

Static Example

The top version is antialiased, whilst the bottom is not.
Screen Shot 2016-03-11 at 21.40.27

Live Example

To view the live version of this please click on ‘edit on CodePen’ thanks @smfr for mentioning this.

See the Pen CSS – Font Smoothing by Michael Gearon (@michaelgearon) on CodePen.0

Michael Gearon

Written by

Michael Gearon

Senior Interaction Designer and Co-Author to Tiny CSS Projects