Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf ·...

107
Vertical Rhythm (and Alignment) Elika J. Etemad aka fantasai W3C CSS Working Group Invited Expert

Transcript of Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf ·...

Page 1: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Vertical Rhythm(and Alignment)

Elika J. Etemad aka fantasaiW3C CSS Working Group Invited Expert

Page 2: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Typographer’s Line Placement Model

Goal: Look pretty.

Tools: Measure and adjust.

Page 3: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Top line visually aligns with other things.

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the float

eventually, assuming it's long enough toreach a few lines below the bottom of it...

Page 4: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Space lines for pleasant reading and to accommodateascenders/descenders/superscripts/subscripts/ruby.

Page 5: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Consistent baseline-to-baseline spacing creates vertical rhythm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

Lorem IpsumLorem ipsum dolor sit amet, consectetur adipiscingelit, sed do eiusmod tempor incididunt ut labore etdolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitationullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit involuptate velit esse cillum dolore eu fugiat nullapariatur.

Excepteur sint

Excepteur sint occaecat cupidatat non proident, suntin culpa qui officia deserunt mollit anim id estlaborum.

Sed ut perspiciatis unde omnis iste natus error sitvoluptatem accusantium doloremque laudantium,totam rem aperiam, eaque ipsa quae ab illoinventore veritatis et quasi architecto beatae vitaedicta sunt explicabo. Nemo enim ipsam voluptatemquia voluptas sit aspernatur aut odit aut fugit, sed

d l

Page 6: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

If your stuff overlaps it’s your fault.

FRANÇOISRÉMY

So review and tweak your things before you print them!

Page 7: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

CSS Line Box Model

Goal: Don't overlap content.

Tools: Boxes.

Page 8: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

1. Put a bunch of stuff on a line.

Page 9: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

2. Draw a box around it.

Page 10: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

3. Stack up the line boxes.

Page 11: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

3. Stack up the line boxes.

Page 12: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

4. All done!

Page 13: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Vertical Rhythm

Page 14: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 15: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 16: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Intra-Paragraph + Inter-Paragraph + Interrupts

Page 17: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Intra-Paragraph Spacing

Page 18: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Fixing the Line Layout Model

Goal: Make typographers happy. Also, don't overlap the content.

Page 19: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

CSS Line Layout Today

Page 20: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

What are the sizes?

Page 21: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Sizes found from font metrics

Page 22: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

It could be so simple...

1em

ÉpAhem

ApSawasdee

Page 23: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Identical font-size, varying font-family

ApSawasdee

ApArial

Ap

Arial Unicode MS

ApBank Gothic

Ap

Bernhard Fashion

Ap

Forte

Page 24: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Identical font-size, varying font-family

ApSawasdee

ApArial

Ap

Arial Unicode MS

ApBank Gothic

Ap

Bernhard Fashion

Ap

Forte

Page 25: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

line-height: # | len | % | normal

Page 26: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

line-height: 1.5;

/* 1.5 × font-size */

Page 27: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Half-leading

  1.5em

1em + leading

Ap 1.5em

font height + leading

Page 28: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

line-height: 1.5

Page 29: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Why half-leading instead of line gaps?

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporincididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex eacommodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur.

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollitanim id est laborum.

Page 30: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 31: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Base Case: Paragraph of Text, No Font Changes

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

line-height: 1.2

Page 32: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Page 33: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Page 34: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Page 35: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Complication #1: Varying Font Families

Page 36: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

ApSawasdee

ApArial

Ap

Arial Unicode MS

Ap

Bank Gothic

Ap

Bernhard Fashion

Ap

Forte

line-height: 1.5

Page 37: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

ApSawasdee

ApArial

Ap

Arial Unicode MS

Ap

Bank Gothic

Ap

Bernhard Fashion

Ap

Forte

line-height: 1.5

Page 38: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

ApSawasdee

ApArial

Ap

Arial Unicode MS

Ap

Bank Gothic

Ap

Bernhard Fashion

Ap

Forte

line-height: 1.5

Page 39: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Small Wins: Ignoring Fallback Font Metrics

My name is 艾俐俐.“The first available font is defined to be the first available font that would match the U+0020 (space)

character.”

Page 40: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

line-height: normal

A 2三 d E q

Page 41: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 42: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Happiness is Rare

CSS Model Typographer’s Model

(No change in font-size, font-family, or vertical-align)

Page 43: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 44: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Fixing Intra-Paragraph Spacing

Page 45: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

How to Have Perfect Rhythm

Start with the root inline box.

Ignore all its contents.

Perfect rhythm!

But what about overlap?

Page 46: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Page 47: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillumdolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Page 48: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

How to Have Perfect Rhythm

Start with the root inline box.

Ignore all its contents.

Perfect rhythm!

But what about overlap?

Page 49: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptatevelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecatcupidatat non proident, sunt in culpa qui officia deserunt mollit anim id estlaborum.

Page 50: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Redefining “fit within a line box”

Page 51: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

“fit”container ← item

Page 52: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Defining the container

     A B C D

Safe ModelGrow if item overflows root line-height.

Sparse ModelGrow if item overflows root line-height + 1/2 line

gap.Absolute Model

Ignore all inline contents. Bigger items alwaysoverflow.

Page 53: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 54: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Defining the item

Leading Box Model

Margin Box Model?

Page 55: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 56: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Content Area

Page 57: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Content Area

Page 58: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Content Area = Font Height Area

ApSawasdee

ApArial

Ap

Arial Unicode MS

ApBank Gothic

Ap

Bernhard Fashion

Ap

Forte

Page 59: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 60: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Old Model

ApSawasdee

ApArial

Ap

Arial Unicode MS

Ap

Bank Gothic

Ap

Bernhard Fashion

Ap

Forte

Page 61: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 62: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

New Normal?

  ApSawasdee

ApArial

Ap

Arial Unicode MS

ApBank Gothic

Ap

Bernhard Fashion

Ap

Forte

Page 63: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 64: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

line-sizing: legacy | normal

legacy

Do what CSS2.1 saysnormal

TBD! (Help us D?)

Page 65: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

</Intra-Paragraph Spacing>

Page 66: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Inter-Paragraph Spacing!

Page 67: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Margins!

p { margin: 1em 0; }

Page 68: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Margins!

p { line-height: 1.5em; margin: 1.5em 0; }

Page 69: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Margins!

p { line-height: 1.5em; margin: 1lh 0; }

Page 70: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Interrupting the Rhythm

Page 71: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Strict Rhythm...

Lorem IpsumLorem ipsum dolor sit amet, consectetur adipiscingelit, sed do eiusmod tempor incididunt ut labore etdolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitationullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit involuptate velit esse cillum dolore eu fugiat nullapariatur.

Excepteur sint

Excepteur sint occaecat cupidatat non proident, suntin culpa qui officia deserunt mollit anim id estlaborum.

Sed ut perspiciatis unde omnis iste natus error sitvoluptatem accusantium doloremque laudantium,totam rem aperiam, eaque ipsa quae ab illoinventore veritatis et quasi architecto beatae vitaedicta sunt explicabo. Nemo enim ipsam voluptatemquia voluptas sit aspernatur aut odit aut fugit, sed

d l

Page 72: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 73: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Strict Rhythm...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

Lorem IpsumLorem ipsum dolor sit amet, consectetur adipiscingelit, sed do eiusmod tempor incididunt ut labore etdolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitationullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit involuptate velit esse cillum dolore eu fugiat nullapariatur.

Excepteur sint

Excepteur sint occaecat cupidatat non proident, suntin culpa qui officia deserunt mollit anim id estlaborum.

Sed ut perspiciatis unde omnis iste natus error sitvoluptatem accusantium doloremque laudantium,totam rem aperiam, eaque ipsa quae ab illoinventore veritatis et quasi architecto beatae vitaedicta sunt explicabo. Nemo enim ipsam voluptatemquia voluptas sit aspernatur aut odit aut fugit, sed

d l

Page 74: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 75: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Strict rhythms are important for multicol

Page 76: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Loose Rhythm...

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

Lorem IpsumLorem ipsum dolor sit amet, consectetur adipiscingelit, sed do eiusmod tempor incididunt ut labore etdolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitationullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit involuptate velit esse cillum dolore eu fugiat nullapariatur.

Excepteur sint

Excepteur sint occaecat cupidatat non proident, suntin culpa qui officia deserunt mollit anim id estlaborum.

Sed ut perspiciatis unde omnis iste natus error sitvoluptatem accusantium doloremque laudantium,totam rem aperiam, eaque ipsa quae ab illoinventore veritatis et quasi architecto beatae vitaedicta sunt explicabo. Nemo enim ipsam voluptatemquia voluptas sit aspernatur aut odit aut fugit, sed

d l

Page 77: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 78: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Block Step Sizing

https://www.w3.org/TR/css-rhythm/

Page 79: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

block-step-size: <length>

Requires used height = n × <length>, for an integer n

Page 80: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

block-step-insert: margin | padding

Page 81: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

block-step-align: auto | center | start | end

Page 82: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

intra

What happens at page/column breaks?

Page 83: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited
Page 84: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

</Inter-Paragraph Spacing>

Page 85: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Trimming Text

Page 86: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Align Me!Here's some paragraph text

following the heading, which should wraparound the float eventually, assuming it'slong enough to reach a few lines belowthe bottom of it...

Page 87: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Delete the top margin...

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the float

eventually, assuming it's long enough toreach a few lines below the bottom of it...

Page 88: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Add negative margin???

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the floateventually, assuming it's long

enough to reach a few lines below thebottom of it...

Page 89: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

>_____<

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the floateventually, assuming it's long

enough to reach a few lines below thebottom of it...

Page 90: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

OpenType metrics

alphabetic baseline Apascent

descent

cap-height

ex-height

Page 91: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

leading-trim-over: normal | text | cap | ex | ideographic

leading-trim-under: normal | text | alphabetic | ideographic

Page 92: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

h2 { leading-trim: cap; }

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the floateventually, assuming it's long

enough to reach a few lines below thebottom of it...

Page 93: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

h2 { leading-trim: cap; }

Align Me!Here's some paragraph textfollowing the heading, whichshould wrap around the float

eventually, assuming it's long enough toreach a few lines below the bottom of it...

Page 94: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

h2 { leading-trim: cap; }

Page 95: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

h2 { leading-trim: cap; }

Page 96: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

I thought this was a World-Wide Web?

CAP HEIGHT

EX HEIGHT????

IDEOGRAPHIC CHARACTER FACE TOP

Page 97: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Your metrics are bad, and you should feel bad.

Page 98: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Open Questions

Behavior at page/column breaks?

Separate cascading/inheritance of metric vs. trigger?

Multiple font sizes on the first/last line?

Page 99: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

Vertical Alignment

Page 100: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

unaligned text

AbraCadabra!

Page 101: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

match baselines, then shift

AbraCadabra!

Page 102: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

match baselines, then shift

Cadabra!Abra

Page 103: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

But which baseline?

In a well-designed mixed-script font, the glyphs are positioned in the coordinate space to harmonize with one another when typeset together. The baselinetable is then constructed to match the shape of the glyphs, each baseline positioned to match the glyphs from its preferred scripts.

Page 104: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

dominant-baseline: auto | alphabetic | ideographic | central | mathematical |

Page 105: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

vertical-align: <'alignment-baseline'> || <'baseline-shift>

└ alignment-baseline: baseline | alphabetic | ideographic | central | …

└ baseline-shift: sub | super | <length>

Page 106: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

initial-letters: 2;

Page 107: Vertical Rhythm - fantasaifantasai.inkedblade.net/style/talks/vertical-rhythm/slides.pdf · Vertical Rhythm (and Alignment) Elika J. Etemad a ka fantasai W3C CSS Working Group Invited

How to Help

Think about / comment on issues.

Bug browser vendors to implement once specced.

Bug font vendors to provide correct metrics.

Bug OpenType to define missing metrics.