104
Responsive Typography https://flic.kr/p/2mjtwC Clarissa Peterson @clarissa

Responsive Typography II

Embed Size (px)

DESCRIPTION

Your content is the most important feature of your website, so it's important to make sure that the text looks good and is easy to read no matter what device type or screen size it's being viewed on. One size does not fit all when it comes to typography, but you can use media queries to adjust type qualities such as size, line height, column width, margins, hyphenation, and even typeface depending on the viewport size. Learn how you can use CSS to apply design rules that will make your typography look better and perform better across devices. You'll also find out how typography affects the loading time of your website, and what you can do to improve performance. Presented at Bmoresponsive (May 2014), ConvergeSE (May 2014), STC Summit (May 2014) and Mobile +Web Dev Conference (July 2014).

Citation preview

Page 1: Responsive Typography II

Responsive Typography

https://flic.kr/p/2mjtwC

Clarissa Peterson

@clarissa

Page 2: Responsive Typography II

Communication

https://flic.kr/p/6xyFnt

Page 3: Responsive Typography II

Default Font Sizehttps://flic.kr/p/4r1D8w

Page 4: Responsive Typography II

body { font-size: 100%; }

Page 5: Responsive Typography II

https://flic.kr/p/8iNCNU

Page 6: Responsive Typography II

Scale

https://flic.kr/p/dhufQk

Page 7: Responsive Typography II

http://skinnyties.com/

Page 8: Responsive Typography II

http://skinnyties.com/

Page 9: Responsive Typography II

http://www.linksture.com/

Page 10: Responsive Typography II

http://www.linksture.com/

Page 13: Responsive Typography II

http://www.tilde.io/

Page 14: Responsive Typography II

http://www.tilde.io/

Page 15: Responsive Typography II

http://www.oliverharvey.co.uk/

Page 16: Responsive Typography II

http://www.oliverharvey.co.uk/

Page 17: Responsive Typography II

https://flic.kr/p/eYEFGY

Ems

Page 18: Responsive Typography II
Page 19: Responsive Typography II

1em = default

Page 20: Responsive Typography II

2em = twice as big1em = default

Page 21: Responsive Typography II

2em = twice as big1em = default

.5em = half as big

Page 22: Responsive Typography II

h1 { font-size: 3em; }h2 { font-size: 2em; }h3 { font-size: 1.5em; }

p { font-size: 1em; }

Page 23: Responsive Typography II

h1 { font-size: 3em; }h2 { font-size: 2em; }h3 { font-size: 1.5em; }

Page 24: Responsive Typography II

h1 { font-size: 3em; }h2 { font-size: 2em; }h3 { font-size: 1.5em; }

Page 25: Responsive Typography II

<p>This is 1 em.</p>

<div>This is 2 ems <span>(and 1.5 ems)</span>.</div>

Page 26: Responsive Typography II

<p>This is 1 em.</p>

<div>This is 2 ems <span>(and 1.5 ems)</span>.</div>

p { font-size: 1em; }div { font-size: 2em; }span { font-size: 1.5em; }

Page 27: Responsive Typography II

<p>This is 1 em.</p>

<div>This is 2 ems <span>(and 1.5 ems)</span>.</div>

p { font-size: 1em; }div { font-size: 2em; }span { font-size: 1.5em; }

Page 28: Responsive Typography II

Thoughtful CSS

https://flic.kr/p/bUxzCm

Page 29: Responsive Typography II
Page 30: Responsive Typography II

div { font-size: 1.1em; }

Page 31: Responsive Typography II

div { font-size: 1.2em; }

Page 32: Responsive Typography II

https://flic.kr/p/5a4L3p

Rems

Page 33: Responsive Typography II

html { font-size: 100%; }

Page 34: Responsive Typography II

Pixel Fallback

https://flic.kr/p/GedyD

Page 35: Responsive Typography II

h1 { font-size: 32px; font-size: 2rem; }

Page 36: Responsive Typography II

Line Height (Leading)

https://flic.kr/p/4EDFYF

Page 37: Responsive Typography II

p { line-height: 1; }

p { line-height: 2; }

Page 38: Responsive Typography II
Page 39: Responsive Typography II
Page 40: Responsive Typography II

p { line-height: 1; }

Page 41: Responsive Typography II

p { line-height: 2; }

Page 42: Responsive Typography II

p { line-height: 1.4; }

Page 43: Responsive Typography II

p { line-height: 1.3 }

Page 44: Responsive Typography II

p { line-height: 1.3 }

@media only screen and (min-width: 30em) {p { line-height: 1.4 }}

Page 45: Responsive Typography II

p { line-height: 1.3 }

@media only screen and (min-width: 30em) {p { line-height: 1.4 }}

@media only screen and (min-width: 60em) {p { line-height: 1.5 }}

Page 46: Responsive Typography II

Vertical Margins

https://flic.kr/p/4qc5EB

Page 47: Responsive Typography II

p { line-height: 1.5; margin-top: 1.5em; margin-bottom: 1.5em;}

Page 48: Responsive Typography II
Page 49: Responsive Typography II

Line Length (Measure)

http://en.wikipedia.org/wiki/File:Metal_movable_type.jpg

Page 50: Responsive Typography II
Page 51: Responsive Typography II
Page 52: Responsive Typography II

45-75 Characters

Page 53: Responsive Typography II

65586573686766

74726969

Page 54: Responsive Typography II
Page 55: Responsive Typography II

.testing { color: #f00; }

Page 56: Responsive Typography II

.testing { color: #f00; }

<p>These stories are true. Although I have left <span class=”testing”>the strict line of historical</span> truth in many places, the animals in this book were all real characters.</p>

Page 57: Responsive Typography II

.testing { color: #f00; }

<p>These stories are true. Although I have left <span class=”testing”>the strict line of historical</span> truth in many places, the animals in this book were all real characters.</p>

Page 59: Responsive Typography II

http://trentwalton.com

Page 60: Responsive Typography II

http://trentwalton.com

Page 61: Responsive Typography II

http://trentwalton.com

Page 62: Responsive Typography II

http://trentwalton.com

Page 63: Responsive Typography II

http://trentwalton.com

Page 64: Responsive Typography II

article p { line-height: 1.3; margin: 1.3em 0;}

article { width: 94%; margin: auto;}

Page 65: Responsive Typography II
Page 66: Responsive Typography II

max-widthhttps://flic.kr/p/7nCGk3

Page 67: Responsive Typography II
Page 68: Responsive Typography II

article { max-width: 28em; }

Page 69: Responsive Typography II

article { max-width: 28em; }

Page 70: Responsive Typography II
Page 71: Responsive Typography II

@media only screen and (min-width:48em) { article { font-size: 1.1em; } article p { line-height: 1.4; margin: 1.4em auto; }}

Page 72: Responsive Typography II

http://www.mqtest.io

Page 73: Responsive Typography II
Page 74: Responsive Typography II

@media only screen and (min-width:60em) { article { font-size: 1.2em; } article p { line-height: 1.5; margin: 1.5em auto; }}

Page 75: Responsive Typography II
Page 76: Responsive Typography II
Page 77: Responsive Typography II

Media Queries

https://flic.kr/p/ajTNcB

Page 78: Responsive Typography II

https://flic.kr/p/8U1KwJ

Page 79: Responsive Typography II

Alignment & Hyphenationhttps://flic.kr/p/8veLPW

Page 80: Responsive Typography II
Page 81: Responsive Typography II

.hyphenate { -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto;}

Page 82: Responsive Typography II

@media only screen and (max-width: 40em) { .hyphenate { -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; }}

Page 83: Responsive Typography II

Easy to read

https://flic.kr/p/8iCtLv

Page 84: Responsive Typography II

article p:first-of-type { font-size: 1.2em; }

Page 85: Responsive Typography II

Typeface

https://flic.kr/p/5q1Qj1

Page 86: Responsive Typography II
Page 87: Responsive Typography II
Page 88: Responsive Typography II

#intro { font-size: 1em; font-family: Helvetica, sans-serif;}

Page 89: Responsive Typography II

#intro { font-size: 1em; font-family: Helvetica, sans-serif;}

@media only screen and (min-width:30em) { #intro { font-size: 1.2em; font-family: Populaire, sans-serif; text-transform: uppercase; }}

Page 90: Responsive Typography II

Performance

Page 91: Responsive Typography II

Web Fonts

https://flic.kr/p/51wXrK

Page 92: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); src: local('Example Font'), url('ExampleFont.eot?#iefix') format('embedded-opentype'), url('ExampleFont.woff') format('woff'), url('ExampleFont.ttf') format('truetype'), url('ExampleFont.svg') format('svg'); font-style: normal;font-weight: 400;}

Page 93: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); src: local('Example Font'), url('ExampleFont.eot?#iefix') format('embedded-opentype'), url('ExampleFont.woff') format('woff'), url('ExampleFont.ttf') format('truetype'), url('ExampleFont.svg') format('svg'); font-style: normal;font-weight: 400;}

Page 94: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); src: local('Example Font'), url('ExampleFont.eot?#iefix') format('embedded-opentype'), url('ExampleFont.woff') format('woff'), url('ExampleFont.ttf') format('truetype'), url('ExampleFont.svg') format('svg'); font-style: normal;font-weight: 400;}

Page 95: Responsive Typography II

Use fewer fonts

Page 96: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); }

Page 97: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); }

p { font-family: Arial, sans-serif; }

Page 98: Responsive Typography II

@font-face { font-family: ExampleFont; src: url('ExampleFont.eot'); }

p { font-family: Arial, sans-serif; }

@media only screen and (min-width: 30em) { p { font-family: ExampleFont, Arial, sans-serif; }}

Page 99: Responsive Typography II

System Fonts

https://flic.kr/p/eiyWiy

Page 100: Responsive Typography II

http://www.jordanm.co.uk/tinytype

Page 101: Responsive Typography II

http://www.jordanm.co.uk/tinytype

h1 { font-family: Helvetica, Arial, 'Droid Sans', sans-serif; }

Page 103: Responsive Typography II

Communication

https://flic.kr/p/6xyFnt