CSS font-stacks

30
CSS FONT STACKS

description

A presentation on CSS font stacks - covering how to choose fonts that have similar aspect ratio and include a good range of fall-back fonts.

Transcript of CSS font-stacks

Page 1: CSS font-stacks

CSSFONT STACKS

Page 2: CSS font-stacks

What are fontstacks?

Page 3: CSS font-stacks

Font stacks are about creating arelevant and comprehensive

list of fall-back fonts - based onaspect ratio, platforms, operating

systems etc.

Page 4: CSS font-stacks

A bad example

Page 5: CSS font-stacks

body{

font-family: Verdana, Arial,sans-serif;

}

What’s wrong here?

Page 6: CSS font-stacks

Problem 1:There are a limited number of

fallback fonts.

Page 7: CSS font-stacks

Problem 2:The fonts used may not be

available for all operating systems(eg. Windows, Mac, Linux).

Page 8: CSS font-stacks

Problem 3:The fonts used have different

“aspect ratios”

Page 9: CSS font-stacks

What isaspect ratio?

Page 10: CSS font-stacks

Some fonts, especially thosespecifically designed for screen,may appear wider and/or taller

than other fonts.

ax axVerdana @200pt Helvetica @200pt

Page 11: CSS font-stacks

This means that these fonts havea larger aspect ratio.

Page 12: CSS font-stacks

If you use font’s with differentaspect ratio, some people maysee your pages with a much

smaller font size than others.

body{

font-family: Verdana, Arial,sans-serif;

}

Larger aspect ratio

Smaller aspect ratio

Page 13: CSS font-stacks

Ideally, your font stacks shouldinclude a range of fonts that have

a similar aspect ratio.

Page 14: CSS font-stacks

The basic fontstacks based on

aspect ratio

Page 15: CSS font-stacks

Wide sans-serif stack

eg:

VerdanaGeneva

Page 16: CSS font-stacks

Narrow sans-serif stack

eg:

TahomaArial

Hevetica

Page 17: CSS font-stacks

Wide serif stack

eg:

GeorgiaUtopia

Page 18: CSS font-stacks

Narrow serif stack

eg:Times

Times New Roman

Page 19: CSS font-stacks

Monospace stack

eg:Courier

Courier New

Page 20: CSS font-stacks

Some steps tocreating a good

font stack

Page 21: CSS font-stacks

1. Pick the font you like

eg. Helvetica Neue

Page 22: CSS font-stacks

2. Determine whichbasic font-stack it belongs in

eg. Narrow sans-serif

Page 23: CSS font-stacks

3. Choose a preferred Linuxvariation and a highly available

variation

eg. DejaVu Sans - 90.76% availability on LinuxURW Gothic L - 97.14% availability on Linux

Page 24: CSS font-stacks

4. Choose a preferred Macintoshvariation and highly available

variation

eg. Helvetica Neue - 95.11% availability on Mac,Helvetica - 100.00% availability on Mac

Page 25: CSS font-stacks

5. Choose a preferred Windowsvariation and a highly available

variation

eg. Arial - 99.32% availability on Win,Microsoft Sans-serif - 99.71% availability on Win

Page 26: CSS font-stacks

6. Include the generic font family

eg. sans-serif

Page 27: CSS font-stacks

7. Make sure fonts withwhite-space in names arewrapped in single or double

quotes.

(eg. “Microsoft Sans-serif”)

Page 28: CSS font-stacks

body{

font-family:"DejaVu Sans", "URW Gothic L","Helvetica Neue”, Helvetica,Arial, "Microsoft Sans Serif",sans-serif;

}

A better font stack?

Page 29: CSS font-stacks

ResultsFont name

DejaVu Sans

URW Gothic L

Helvetica Neue

Helvetica

Arial

Microsoft Sans Serif

sans-serif

Windows

0.00%

0.00%

1.51%

7.08%

90.79%

0.62%

0.00%

Mac

0.00%

0.00%

95.11%

4.89%

0.00%

0.00%

0.00%

Linux

90.76%

8.98%

0.00%

0.07%

0.13%

0.00%

0.06%

Page 30: CSS font-stacks

A great font-stack builder

Font stackhttp://www.codestyle.org/servlets/FontStack