Top Banner
Dominating the Web Typography Eduardo Shiota Yasuda — @shiota Conferência CSS Brasil
206
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dominating the Web Typography

Dominating the

Web Typography

Eduardo Shiota Yasuda — @shiota Conferência CSS Brasil

Page 2: Dominating the Web Typography

Hello! twitter.com/shiota github.com/eshiota slideshare.net/eshiota [email protected]

Page 3: Dominating the Web Typography
Page 4: Dominating the Web Typography

I Typography

Page 5: Dominating the Web Typography

Typography is everywhere.

Page 6: Dominating the Web Typography
Page 7: Dominating the Web Typography
Page 8: Dominating the Web Typography
Page 9: Dominating the Web Typography
Page 10: Dominating the Web Typography
Page 11: Dominating the Web Typography
Page 12: Dominating the Web Typography
Page 13: Dominating the Web Typography

We gotta remember the roots of what we do.

Page 14: Dominating the Web Typography

15.000 BC – 12.500 BCAltamira & Lascaux

Page 15: Dominating the Web Typography

3.000 BC – 1.500 BCPictographs

Page 16: Dominating the Web Typography

1.500 BCPhoenician alphabet

Page 17: Dominating the Web Typography

750 BCGreek alphabet

Page 18: Dominating the Web Typography

146 BCRoman alphabet, “Capitalis quadrata”

Page 19: Dominating the Web Typography

0Better materials, “Capitalis rustica”

Page 20: Dominating the Web Typography

4th – 5th centuriesUncials and semi-uncials

Page 21: Dominating the Web Typography

8th centuryCarolingian minuscules

Page 22: Dominating the Web Typography

12th centuryApex of goth art and Middle Ages

Page 23: Dominating the Web Typography

15th – 16th centuriesRenaissance, Gutenberg press, “Cursiva humanista”, type foundries

Page 24: Dominating the Web Typography

19th centuryIndustrial Revolution, linotype, Art Nouveau, display types

Page 25: Dominating the Web Typography

20th centuryModern Design, Avant-garde, Bauhaus, sans-serif types, digital typography

Page 26: Dominating the Web Typography

21th centuryWeb typography and CSS

Page 27: Dominating the Web Typography

The basics

Page 28: Dominating the Web Typography

Basics

Classification

Page 29: Dominating the Web Typography

Most of the classification systems agree with these type categories:

Page 30: Dominating the Web Typography

Serif types

Page 31: Dominating the Web Typography

Museo

The quick brown fox jumps over the lazy dog.

Meta Serif

The quick brown fox jumps over the lazy dog.

Times New Roman

The quick brown fox jumps over the lazy dog.

Page 32: Dominating the Web Typography

Sans serif types

Page 33: Dominating the Web Typography

Futura

The quick brown fox jumps over the lazy dog.Museo Sans

The quick brown fox jumps over the lazy dog.

Helvetica

The quick brown fox jumps over the lazy dog.

Page 34: Dominating the Web Typography

Gothic types

Page 35: Dominating the Web Typography

Fette Fraktur

The quick brown fox jumps over the lazy dog.

Goudy Text

The quick brown fox jumps over the lazy dog.

Wilhelm Klingspor Gotisch

The quick brown fox jumps over the lazy dog.

Page 36: Dominating the Web Typography

Cursive types

Page 37: Dominating the Web Typography

Lucida Calligraphy

The quick brown fox jumps over the lazy dog.Mistral

The quick brown fox jumps over the lazy dog.

Apple Chancery

The quick brown fox jumps over the lazy dog.

Page 38: Dominating the Web Typography

Display types

Page 39: Dominating the Web Typography

Comic Sans

The quick brown fox jumps over the lazy dog.Sketch Rockwell

The quick brown fox jumps over the lazy dog.

GodOfWar

The quick brown fox jumps over the lazy dog.

Page 40: Dominating the Web Typography

Dingbats

Page 41: Dominating the Web Typography

Bodoni Ornaments

The quick brown fox jumps

over the lazy dog.

Travel Icons

The quick brown fox jumps over the lazy dog.

Wingdings

The quick brown fox jumps over the lazy dog.

Page 42: Dominating the Web Typography

On the CSS, you may choose generic families as fallbacks.

Page 43: Dominating the Web Typography

.my-serif-text { font-family: "Meta Serif", Times, serif; }

.my-sans-serif-text { font-family: "Proxima Nova", Arial, sans-serif; }

.my-monospace-text { font-family: Monaco, "Courier New", monospace; }

.my-cursive-text { font-family: "Zapf Chancery", "Brush Script", cursive; }

.my-fantasy-text { font-family: "Sketch Rockwell", Papyrus, fantasy; }

Page 44: Dominating the Web Typography

Basics

Anatomy of a type

Page 45: Dominating the Web Typography
Page 46: Dominating the Web Typography

baseline

font size

Page 47: Dominating the Web Typography

Typographybaseline

descender height

x-height

cap height

ascender height

Page 48: Dominating the Web Typography

Typography

Page 49: Dominating the Web Typography

T

y

p

o

g

r

a

p

h

y

Page 50: Dominating the Web Typography

Basics

Units

Page 51: Dominating the Web Typography

Physical units

Page 52: Dominating the Web Typography

To deal with physical units, you can’t rely on a screen.

Page 53: Dominating the Web Typography

pt picas millimetres inches

12 1 4.22 1/6

Page 54: Dominating the Web Typography

A4 (29.7cm × 21.0cm)

Page 55: Dominating the Web Typography

Pixel (px)

Page 56: Dominating the Web Typography

To deal with screens, you must understand what are physical and reference pixels.

Page 57: Dominating the Web Typography

A physical pixel is a physical point on the display.

Page 58: Dominating the Web Typography
Page 59: Dominating the Web Typography

A reference pixel depends on the device, software and user settings.

Page 60: Dominating the Web Typography
Page 61: Dominating the Web Typography

A 16px font on a smartphone screen won’t have as many millimetres as on a desktop screen.

Page 62: Dominating the Web Typography
Page 63: Dominating the Web Typography

Change, test, use media queries, test again.

Page 64: Dominating the Web Typography

em unit (em)

Page 65: Dominating the Web Typography

“em” is a relative unit used since the movable types.

Page 66: Dominating the Web Typography

It represents a type’s full body size.

Page 67: Dominating the Web Typography

1 em

Page 68: Dominating the Web Typography

16px 1 em

margin-right: 1em;

16px

Page 69: Dominating the Web Typography

It’s always relative to its context’s font size.

Page 70: Dominating the Web Typography

.wrapper { font-size: 16px; }

.parent { font-size: 1.5em; }

.child { font-size: .5em; }

Page 71: Dominating the Web Typography

Root em unit (rem)

Page 72: Dominating the Web Typography

“rem” is like “em” but always relative to the root (html).

Page 73: Dominating the Web Typography

html { font-size: 16px; }

.wrapper { font-size: 12px; }

.parent { font-size: 1.5rem; }

.child { font-size: 0.5rem; }

Page 74: Dominating the Web Typography

For most of browsers and cases, the default root font size is 16px.

Page 75: Dominating the Web Typography

html { font-size: 16px; }

.wrapper { font-size: 12px; }

.parent { font-size: 1.5rem; }

.child { font-size: 0.5rem; }

Page 76: Dominating the Web Typography

html { font-size: 100%; }

.wrapper { font-size: 12px; }

.parent { font-size: 1.5rem; }

.child { font-size: 0.5rem; }

Page 77: Dominating the Web Typography

Rhythm

Page 78: Dominating the Web Typography

The way you space your characters and text dictates how a person will read it.

Page 79: Dominating the Web Typography

Rhythm

Line height

Page 80: Dominating the Web Typography

Line height is the distance between each line of types.

Page 81: Dominating the Web Typography

The quick fox jumps over the dog

0 pixels

Meta Serif 102px/102px

Page 82: Dominating the Web Typography

The quick fox jumps over the dog

Meta Serif 102px/144px

42 pixels

Page 83: Dominating the Web Typography

A low line height makes the text too difficult to read.

Page 84: Dominating the Web Typography

Helvetica 32px/32px

“The Guide says that the best drink in existence is the Pan Galactic Gargle Blaster. It says that the effect of a Pan Galactic Gargle Blaster is like having your brains smashed out by a slice of lemon wrapped round a large gold brick.”

Page 85: Dominating the Web Typography

A large line height makes the paragraph loose cohesion.

Page 86: Dominating the Web Typography

Helvetica 32px/96px

“The Guide says that the best drink in existence is the Pan

Galactic Gargle Blaster. It says that the effect of a Pan Galactic

Gargle Blaster is like having your brains smashed out by a slice

of lemon wrapped round a large gold brick.”

Page 87: Dominating the Web Typography

Find a comfortable proportion through trial-and-error.

Page 88: Dominating the Web Typography

Helvetica 32px/48px

“The Guide says that the best drink in existence is the Pan Galactic Gargle Blaster. It says that the effect of a Pan Galactic Gargle Blaster is like having your brains smashed out by a slice of lemon wrapped round a large gold brick.”

Page 89: Dominating the Web Typography

Each typeface might require a different line height setting.

Page 90: Dominating the Web Typography

Bembo 32px/48px

“The Guide says that the best drink in existence is the Pan Galactic

Gargle Blaster. It says that the effect of a Pan Galactic Gargle Blaster is

like having your brains smashed out by a slice of lemon wrapped

round a large gold brick.”

Page 91: Dominating the Web Typography

Caslon 32px/48px

“The Guide says that the best drink in existence is the Pan

Galactic Gargle Blaster. It says that the effect of a Pan

Galactic Gargle Blaster is like having your brains smashed

out by a slice of lemon wrapped round a large gold brick.”

Page 92: Dominating the Web Typography

Rhythm

Baseline

Page 93: Dominating the Web Typography

Use a consistent vertical proportion by following a baseline.

Page 94: Dominating the Web Typography

9 reasons why cats will conquer the world. The number 5 will surprise you!

“More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.”

Page 95: Dominating the Web Typography

9 reasons why cats will conquer the world. The number 5 will surprise you!

“More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.”

Page 96: Dominating the Web Typography

Choose a line height for a baseline, and make all vertical values derive from it.

Page 97: Dominating the Web Typography

/* baseline = 24px */

body { font-size: 16px; line-height: 24px; /* baseline */ }

.article-title { font-size: 32px; line-height: 48px; /* 2 × baseline */ }

.article-excerpt { font-size: 18px; line-height: 24px; /* baseline */ }

img { max-height: 312px; /* 13 × baseline */ }

p { margin-bottom: 12px; /* 0.5 × baseline */ }

Page 98: Dominating the Web Typography

If you pre-process your CSS, you ensure a consistent typography using variables.

Page 99: Dominating the Web Typography

// _variables.scss

$base-font-size: 16px; $baseline: 24px;

// On your project:

body { font-size: $base-font-size; line-height: ($baseline/$base-font-size); // 1.5 }

.article-title { font-size: 2*$base-font-size; line-height: 2*$baseline; }

.article-excerpt { font-size: 18px; line-height: $baseline; }

img { max-height: 13*$baseline; }

p { margin-bottom: 0.5*$baseline; }

Page 100: Dominating the Web Typography

Be aware that each browser has its own baseline.

Page 101: Dominating the Web Typography

Rhythm

Letter spacing/tracking

Page 102: Dominating the Web Typography

Letter spacing is the whitespace between each single type.

Page 103: Dominating the Web Typography

Typography

Page 104: Dominating the Web Typography

Typographyletter-spacing: 10px;

Page 105: Dominating the Web Typography

Typographyletter-spacing: -10px;

Page 106: Dominating the Web Typography

The use of letter-spacing is recommended for titles only.

Page 107: Dominating the Web Typography

Epic Movie Title

Page 108: Dominating the Web Typography

Epic Movie Title

Page 109: Dominating the Web Typography

Rhythm

Kerning

Page 110: Dominating the Web Typography

Kerning is a fine-tuning between specific pairs of characters.

Page 111: Dominating the Web Typography
Page 112: Dominating the Web Typography

Task

Page 113: Dominating the Web Typography

The browser default is automatically enabling/disabling it.

Page 114: Dominating the Web Typography
Page 115: Dominating the Web Typography

.kerning { font-kerning: normal; }

32+ 34+ 7+ 10+

Page 116: Dominating the Web Typography

Rhythm

Text indentation

Page 117: Dominating the Web Typography

You can manipulate the text’s indentation, which applies to its first line.

Page 118: Dominating the Web Typography

More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.

Page 119: Dominating the Web Typography

More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.

.post p { text-indent: 2em; }

Page 120: Dominating the Web Typography

For long texts, you can skip the indentation on the first paragraph.

Page 121: Dominating the Web Typography

More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.

.post p { text-indent: 2em; }

.post p:first-of-type { text-indent: 0; }

Page 122: Dominating the Web Typography

More importantly, a towel has immense psychological value.

For some reason, if a strag (strag: nonhitchhiker) discovers that a hitchhiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, washcloth, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet-weather gear, space suit etc., etc.

Furthermore, the strag will then happily lend the hitchhiker any of these or a dozen other items that the hitchhiker might have accidentally "lost.". What the strag will think is that any man that can hitch the length and breadth of the Galaxy, rough it, slum it, struggle against terrible odds, win through and still know where his towel is, is clearly a man to be reckoned with.

.post p + p { text-indent: 2em; }

Page 123: Dominating the Web Typography

Text styling

Page 124: Dominating the Web Typography

You can use CSS rules to properly style your content, like a well-authored book.

Page 125: Dominating the Web Typography

Styling

Titles & subtitles

Page 126: Dominating the Web Typography

Keep a clear hierarchy by using different font sizes, type faces and variants.

Page 127: Dominating the Web Typography
Page 128: Dominating the Web Typography

Styling

Quotes

Page 129: Dominating the Web Typography

A quote block can be highlighted with margins and pseudo-elements.

Page 130: Dominating the Web Typography
Page 131: Dominating the Web Typography

blockquote { margin: 2em 6em; font-size: 24px; line-height: 1.5; font-style: italic; position: relative; }

blockquote:before { content: "“"; position: absolute; left: -.75em; top: 0; font-size: 2.66em; line-height: 1; }

blockquote .author { font-size: .75em; line-height: 1.77; }

Page 132: Dominating the Web Typography

Styling

Elevated caps

Page 133: Dominating the Web Typography

Explore CSS selectors to style specific parts of the text.

Page 134: Dominating the Web Typography

.post p:first-of-type:first-letter { font-size: 4.5em; }

Page 135: Dominating the Web Typography

Styling

OpenType

Page 136: Dominating the Web Typography

OpenType fonts provide features to control and tweak the styles of your text.

Page 137: Dominating the Web Typography
Page 138: Dominating the Web Typography

.my-class { font-variant-caps: small-caps; -moz-font-feature-settings: "smcp"; -ms-font-feature-settings: "smcp"; -webkit-font-feature-settings: "smcp"; font-feature-settings: "smcp"; }

33+ 4+ 10+

Page 139: Dominating the Web Typography
Page 140: Dominating the Web Typography
Page 141: Dominating the Web Typography

Composition

Page 142: Dominating the Web Typography

Composition

Grids and column sizes

Page 143: Dominating the Web Typography

The text should have an ideal line length.

Page 144: Dominating the Web Typography
Page 145: Dominating the Web Typography

A line should have between 60 and 70 characters.

Page 146: Dominating the Web Typography
Page 147: Dominating the Web Typography

.post { width: 744px; margin: 0 auto; }

Page 148: Dominating the Web Typography
Page 149: Dominating the Web Typography

The column size should respond to font size changes.

Page 150: Dominating the Web Typography
Page 151: Dominating the Web Typography

The use of em-based column width might solve the problem.

Page 152: Dominating the Web Typography
Page 153: Dominating the Web Typography
Page 154: Dominating the Web Typography

.post { width: 31em; margin: 0 auto; }

Page 155: Dominating the Web Typography

Rendering

Page 156: Dominating the Web Typography

Rendering

Anti-aliasing and hinting

Page 157: Dominating the Web Typography

Font shapes are vectors that are rasterised to be displayed on pixels.

Page 158: Dominating the Web Typography

Hinting is a manual work of tweaking sub-pixels to maintain a font’s identity and legibility on screen.

Page 159: Dominating the Web Typography
Page 160: Dominating the Web Typography
Page 161: Dominating the Web Typography

Anti-aliasing is an algorithm used to smooth edges.

Page 162: Dominating the Web Typography

Each OS and browsers have a different anti-aliasing and hinting setting.

Page 163: Dominating the Web Typography

OS + Browser Hinting and AA

Win XP — IE6–8 GDI Grayscale

Win XP — IE6–8 ClearType GCI ClearType

IE9+ DirectWrite

Win XP Chrome GDI ClearType

Win XP Firefox GDI ClearType

Win 7+ Chrome 37+ DirectWrite

Win 7+ Firefox Depends?

OS X CoreText, ignores hinting

* Based on a lot of Google searches, might not be accurate

Page 164: Dominating the Web Typography

Test. On. Every. Browser.

Page 165: Dominating the Web Typography
Page 166: Dominating the Web Typography

Choosing

Page 167: Dominating the Web Typography

Choosing

Sources

Page 168: Dominating the Web Typography

Choose a reliable source for your font.

Page 169: Dominating the Web Typography
Page 170: Dominating the Web Typography

The font must have a proper unicode table, kerning, hinting etc.

Page 171: Dominating the Web Typography

Also check for language support, webfont license, OpenType features.

Page 172: Dominating the Web Typography
Page 173: Dominating the Web Typography
Page 174: Dominating the Web Typography
Page 175: Dominating the Web Typography
Page 176: Dominating the Web Typography
Page 177: Dominating the Web Typography

Fonts are expensive for a reason.

Page 178: Dominating the Web Typography

Choosing

Personalities

Page 179: Dominating the Web Typography

Each typeface has a story and a personality, choose one that match yours.

Page 180: Dominating the Web Typography

The quick brown fox jumps over the lazy dog.Bembo — based in engravings from 1495, renaissance style, readable in small font sizes.

Page 181: Dominating the Web Typography

The quick brown fox jumps over the lazy dog.Helvetica — Symbol of the Modern Design, is readable, international and neutral.

Page 182: Dominating the Web Typography

The quick brown fox jumps over the lazy dog.

Museo — The modern, geometric shapes and the rounded, slab serifs give a strong personality to this type.

Page 183: Dominating the Web Typography

Serifs have a refined look, need less line height values, and help maintaining a cohesive text.

Page 184: Dominating the Web Typography
Page 185: Dominating the Web Typography

Sans serifs have a modern look, and increased legibility on screens.

Page 186: Dominating the Web Typography
Page 187: Dominating the Web Typography

Start simple, with a readable body typeface.

Page 188: Dominating the Web Typography

Then format titles and subtitles using different weights and styles.

Page 189: Dominating the Web Typography

Choose a second typeface for titles if needed. Avoid going further than that.

Page 190: Dominating the Web Typography
Page 191: Dominating the Web Typography

Choosing

Performance

Page 192: Dominating the Web Typography

Each font size is extra data that must be downloaded.

Page 193: Dominating the Web Typography
Page 194: Dominating the Web Typography

Measure the impact of each added typeface.

Page 195: Dominating the Web Typography
Page 196: Dominating the Web Typography

You’ll have to choose between speed and non-FOUC.

Page 197: Dominating the Web Typography

Avoid loading custom typefaces on mobile devices.

Page 198: Dominating the Web Typography

I Typography

Page 199: Dominating the Web Typography

We’ve only scratched the surface.

Page 200: Dominating the Web Typography

We are the craftspeople of the web.

Page 201: Dominating the Web Typography
Page 202: Dominating the Web Typography

We should keep our roots in place.

Page 203: Dominating the Web Typography
Page 204: Dominating the Web Typography
Page 205: Dominating the Web Typography

Further reading: The Elements of Typographic Style Robert Bringhurst EN: http://www.amazon.com/Elements-Typographic-Style-Robert-Bringhurst/dp/0881791326 PT-BR: http://editora.cosacnaify.com.br/ObraSinopse/11584/Elementos-do-estilo-tipogr%C3%A1fico---vers%C3%A3o-30.aspx

Thinking with Type Ellen Lupton EN: http://www.amazon.com/Thinking-Type-2nd-revised-expanded/dp/1568989695 PT-BR: http://editora.cosacnaify.com.br/ObraSinopse/1875/Pensar-com-tipos---2%C2%BA-edi%C3%A7%C3%A3o-%28Previs%C3%A3o-de-envio-a-partir-de-200415%29.aspx

Type on Screen Ellen Lupton EN: http://www.amazon.com/Type-Screen-Critical-Designers-Developers/dp/161689170X

On Web Typography Jason Santa Maria EN: http://abookapart.com/products/on-web-typography

Type and Typography Baines & Haslam EN: http://www.amazon.co.uk/Type-Typography-Portfolio-Phil-Baines/dp/1856694372

Page 206: Dominating the Web Typography

Thanks! twitter.com/shiota github.com/eshiota slideshare.net/eshiota [email protected]