Beautiful Web Typography: 7 tips on de-sucking the web

68
Beautiful Web Typography Simon Pascal Klein tips on de-sucking the web

description

Beautiful Web Typography is possible. This presentation looked at 7 tips at how to make the Internet a lovelier and more beautiful place using simple typographic conventions through CSS and general practice.

Transcript of Beautiful Web Typography: 7 tips on de-sucking the web

Page 1: Beautiful Web Typography: 7 tips on de-sucking the web

Beautiful Web Typography

Simon Pascal Klein

tips on de-sucking the web

Page 2: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 1

Introduction

Page 3: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 2

I’m Pascal Klein

Page 4: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 3

I...

Page 5: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 3

I...• work for a small web-dev company based in

Canberra and also operate on a free-lance basis;

Page 6: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 3

I...• work for a small web-dev company based in

Canberra and also operate on a free-lance basis;

• try to use, and support Open Source soware;

Page 7: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 3

I...• work for a small web-dev company based in

Canberra and also operate on a free-lance basis;

• try to use, and support Open Source soware;

• write about typography and whatever else strikes me at the time on klepas.org.

Page 8: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 4

Page 9: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 4

What is typography?

Page 10: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 4

What is typography?ty•pog•ra•phy |tīˈpägrəfē| •n

Typography is the art of creating and setting type with the purpose of honoring the text it sets.

Page 11: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 4

serif sans-serif

Page 12: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 4

e difference

serif sans-serif

Page 13: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

e Intertubes today

Page 14: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

e Intertubes todayLots of information.

Page 15: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

e Intertubes todayLots of information.

Information Architecture deals with this primarily but there is another:

Page 16: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

e Intertubes todayLots of information.

Information Architecture deals with this primarily but there is another:

Typography.

Page 17: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

Page 18: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 5

Typography exists to bring order to information by dividing and organizing – aiding readers in finding what they are looking for.

Page 19: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 6

– Jeff Cro

“Typography is not picking a ‘cool’ font.”

Page 20: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 7

tips to de-suck the web

Page 21: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 8

. Starting out: resetAll the browsers have their own default styling for various (X)HTML elements. is makes it a pain for cross-browser consistency.

Page 22: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 8

. Starting out: resetAll the browsers have their own default styling for various (X)HTML elements. is makes it a pain for cross-browser consistency.

Fix? Simply reset everything.

Page 23: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 9

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {margin:0;padding:0;}table {border-collapse:collapse;border-spacing:0;}fieldset,img {border:0;}address,caption,cite,code,dfn,em,strong,th,var {font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:normal;}q:before,q:after {content:'';}abbr,acronym {border:0;}

Googling “CSS reset stylesheets” should land you with numerous examples. is one above is from the Yahoo! UI library.

Page 24: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 10

. Font sizingFont sizing is done using font-size. It uses any of the CSS numerical measurements and is either done in absolute or relative terms.

Sizing in pixels is absolute whilst sizing in ems or percentages are an example of relative terms.

Page 25: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 11

. Use ems

An em is a relative unit best to be thought of as a box. It is relative to the point size of a specific font (i.e. em in a point typeface is point).

Page 26: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 11

. Use ems

An em is a relative unit best to be thought of as a box. It is relative to the point size of a specific font (i.e. em in a point typeface is point).

To calculate, find what one pixel is in ems and then multiply by the desired font size (in pixels):

1 ÷ parent font-size × required pixel value= em value

Page 27: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 11

. Use ems

An em is a relative unit best to be thought of as a box. It is relative to the point size of a specific font (i.e. em in a point typeface is point).

To calculate, find what one pixel is in ems and then multiply by the desired font size (in pixels):

1 ÷ parent font-size × required pixel value= em value

Note this means sizing in ems can easily have you using values with three decimal places.

Page 28: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 12

.. e . trickRelative font sizes are either relative to the browser default font size (commonly pixels) or their parent element. Consider:p { font-size: 80%; }blockquote { font-size: 80%; }

Page 29: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 12

.. e . trick

80% of 16px is 12.8px, so p and blockquote elements will be that size, but what happens when we put a p element inside a blockquote element? e parent (blockquote) is 12.8px so the p will be rendered at 80% of that – 10.42px.

Relative font sizes are either relative to the browser default font size (commonly pixels) or their parent element. Consider:p { font-size: 80%; }blockquote { font-size: 80%; }

Page 30: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography

In 2004 Richard Rutter wrote an article outlining a trick used to make these calculations simpler: because browsers have a common default font size of 16px we can set the body font size to be 62.5%, resetting the default value to 10px.

From here on, using ems is much easier: px in ems is .em, px is .em. Remember this only holds up for direct child elements of the body; nested elements will be relative to their parents.

.. e . trick (cont’d)

Page 31: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 14

.. Differences in browser rounding

Page 32: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 14

.. Differences in browser roundingMake sure your actual font size in absolute terms is either an integer or half-way in between (i.e. 13px, 13.5px or 14px).

Page 33: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 14

.. Differences in browser roundingMake sure your actual font size in absolute terms is either an integer or half-way in between (i.e. 13px, 13.5px or 14px).

To find an element’s font size in absolute terms (i.e. pixels) you can use the Firefox Web Develop Extension, Information → Display Element Information.

Page 34: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 15

. Stick it to a scaleUse a scale when setting type. Find what suits you best for a given project and stick to it.

6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 36, 48, 60, 72.the “classic scale”

9, 10, 11, 12, 13, 14, 18, 24, 36, 48, 64, 72, 96.another scale

8, 13, 21, 34, 55, 89.scale based on the Fibonacci sequence

Page 35: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 16

. Use Smartypants or similarSmartypants is a script that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities.

• Smartypants (PHP, PERL, & Movable Type);

• Typogrify (Python/Django);

• wp-typogrify (WordPress);

• …?

Page 36: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 17

. Quotation marks & apostrophes

‘ ’ “ ”’

Page 37: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 18

' "

Page 38: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 19

1'61"

Page 39: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 20

"is is a group of words surrounded by a bunch of tick marks."

Page 40: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 21

“is is a quotation!”- Jeff Cro

Page 41: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 22

. Dashes

Page 42: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 22

- hyphen Mary-Anne, Dominique Strauss-Kahn

– en dash April–May, ages –, pp. –

— em dash Phrase marker—not spaced—like this.*

– minus 5–4=1

. Dashes

Page 43: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 23

Traditionally punctuation marks, bullets, lists, hyphens, and brackets all hang in the margin.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer a odio. Vivamus placerat felis id risus. Cras mollis est. Suspendisse molestie imperdiet libero. Etiam mollis libero vulputate lorem. Nullam ut leo. Etiam at turpis non massa rhoncus sodales.)”

(

. Advanced: hanging punctuation

Page 44: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 24

Easily done with lists by just setting their margins to zero.

. Advanced: hanging punctuation (cont’d)

Possible for opening punctuation marks using

background-image or a negative text-indent. CSS3 will hopefully support hanging punctuation with the proposed hanging-punctuation property.[http://www.w3.org/TR/css3-text/#hanging-punctuation]

Page 45: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 25

. Select a good measure

e measure is the length of a single line. It is important to select a good measure for running text. Do this with the width property.

Ideally these should be relative to the font size, such that the type scales proportionately to the measure; use ems or percentages.

Page 46: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 26

. Select a good measure (cond’t)

An apt measure for running text ranges from about - characters for serif type set in a single column on a page (print).

On the web, type generally benefits from a smaller measure. When using multi-column you’ll need to go even smaller.

Page 47: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 26

. Select a good measure (cond’t)

An apt measure for running text ranges from about - characters for serif type set in a single column on a page (print).

Characters average at around two thirds of an em, so a width of to ems matches the above.

On the web, type generally benefits from a smaller measure. When using multi-column you’ll need to go even smaller.

Page 48: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 27

. Treat text as part of the UI

Distinguish content elements from application controls (i.e. a user’s username and description from a logout link or text-field title).

Oen done with colour (i.e. setting controls gray), size (making them smaller) and typefaces.

Page 49: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 28

Page 50: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 29

Page 51: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 30

. Use gridsGrids bring order to your page and help specify where things should go and their flow.

Remember to put in apt “gutters” (margins between columns) to separate your columns particularly when neighbouring columns hold running text.

Ruler guides help enormously – use the Web Developer extension for Firefox or ruler background images. Also see the YUI library.

Page 52: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 30

Page 53: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 30

Page 54: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 31

. e little things

Page 55: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 31

. e little things• Setting the body in a serif and headings in a san

serif or visa-versa work to great effect;

Page 56: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 31

. e little things• Setting the body in a serif and headings in a san

serif or visa-versa work to great effect;

• Set abbr and acronym elements in small caps (using the font-variant property);

Page 57: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 31

. e little things• Setting the body in a serif and headings in a san

serif or visa-versa work to great effect;

• For headings use the most stylish ampersand available (Typogrify wraps them with .amp);

• Set abbr and acronym elements in small caps (using the font-variant property);

Page 58: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 31

. e little things• Setting the body in a serif and headings in a san

serif or visa-versa work to great effect;

• For headings use the most stylish ampersand available (Typogrify wraps them with .amp);

• At small font sizes text-decoration: underline; can render descender characters (g, j, p, q, y) difficult to read – use border-bottom: 1px solid;;

• Set abbr and acronym elements in small caps (using the font-variant property);

Page 59: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 32

. e little things (cond’t)

• Don’t forget to set an ample leading (line height) for running text! Done using the line-height property and you can use a unit-less number (i.e. . which acts as a multiplier of the font size (em if you’re font sizing in ems);

e leading spans from the baseline (don’t worry

about descenders or ascenders.

Page 60: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 33

. e little things (cond’t)

• Don’t be afraid to mark new paragraphs with indents, outdents, a plain white-line, a pilcrow (¶) or other ornament, drop cap and/or headers;

Page 61: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 33

. e little things (cond’t)

• Don’t be afraid to mark new paragraphs with indents, outdents, a plain white-line, a pilcrow (¶) or other ornament, drop cap and/or headers;

• Generally use flush-le (text-align: left;) for running text, particularly when set in a narrow measure – justification can work at ample measures and better with serif typefaces.

Page 62: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 33

. e little things (cond’t)

• Don’t be afraid to mark new paragraphs with indents, outdents, a plain white-line, a pilcrow (¶) or other ornament, drop cap and/or headers;

• Generally use flush-le (text-align: left;) for running text, particularly when set in a narrow measure – justification can work at ample measures and better with serif typefaces.

• High-contrasting link colours in running text distract: use the smallest effective difference;

Page 63: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 34

. I lied – one more

Page 64: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 34

. I lied – one morePlease don’t use Comic Sans unless you have a very, very good reason.

Page 65: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography 25

Free desktop specificStick fonts into ~/.fonts

To reload your font cache:fc-cache -fv

Generally use a serif for printed type; make sure you grab a copy of the Liberation font package from Redhat![https://www.redhat.com/promo/fonts/]

Page 66: Beautiful Web Typography: 7 tips on de-sucking the web

ISBN: ---

Page 68: Beautiful Web Typography: 7 tips on de-sucking the web

Web Typography [email protected]

Inspirational type nuts• http://cameronmoll.com

• http://jeffcro.com

• http://markboulton.co.uk

• http://zeldman.com