Slide 1

Slide 1 text

Writing Modes

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

“ — Bruce Lawson It’ s the World Wide Web, not the Wealthy Western Web.

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

drafts.csswg.org/css-writing-modes

Slide 7

Slide 7 text

direction / dir writing-mode text-orientation

Slide 8

Slide 8 text

Display Level 3

Slide 9

Slide 9 text

drafts.csswg.org/css-display

Slide 10

Slide 10 text

div { display: block; }

Slide 11

Slide 11 text

div { display: inline; }

Slide 12

Slide 12 text

div { display: inline-block; }

Slide 13

Slide 13 text

display: block; display: inline; display: inline-block; display: none; display: table; display: flex; display: grid;

Slide 14

Slide 14 text

display: ;

Slide 15

Slide 15 text

display: ;

Slide 16

Slide 16 text

The outer display type dictates 
 how the box participates in its 
 parent’s formatting context. = block inline run-in

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

The outer display type dictates 
 how the box participates in its 
 parent’s formatting context. = block inline run-in

Slide 20

Slide 20 text

The inner display type defines the kind of formatting context
 it generates, dictating how its descendant boxes are laid out. = flow flex flow-root grid table ruby

Slide 21

Slide 21 text

Short `display` Full `display ` Generated box block block flow block-level block container flow-root block flow-root block-level block container w/ new Block Formatting Context inline inline flow inline box inline-block inline flow-root inline-level block container flex block flex block-level flex container inline-flex inline flex inline-level flex container grid block grid block-level grid container inline-grid inline grid inline-level grid container table block table block-level table wrapper box inline-table inline table inline-level table wrapper box

Slide 22

Slide 22 text

Short `display` Full `display ` Generated box none subtree omitted from box tree contents element replaced by contents in box tree run-in run-in flow run-in box (inline box with special box-tree munging rules) list-item list-item block flow block box with additional marker box inline-list-item list-item inline flow inline box with additional marker box ruby inline ruby inline-level ruby container block ruby block ruby block box containing ruby container layout-specific internal box (a bunch more table & ruby stuff) (like table-row-group, table-column, ruby-base-container…)

Slide 23

Slide 23 text

Writing Modes

Slide 24

Slide 24 text

inline direction When I’m writing or reading this is the way the characters flow

Slide 25

Slide 25 text

block flow direction

Slide 26

Slide 26 text

Acharacter orientation

Slide 27

Slide 27 text

block direction inline direction Acharacter orientation

Slide 28

Slide 28 text

SYSTEMS LIKE LATIN block direction inline direction Acharacter orientation

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

SYSTEMS LIKE ARABIC inline direction block direction Acharacter orientation

Slide 31

Slide 31 text

direction

Slide 32

Slide 32 text

.foo { direction: ltr; } .foo { direction: rtl; }

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

“ — The Writing Modes Spec Authors should not use `direction`.

Slide 35

Slide 35 text

… …

Slide 36

Slide 36 text

… …

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

SYSTEMS LIKE LATIN SYSTEMS LIKE ARABIC block direction inline direction block direction inline direction

Slide 39

Slide 39 text

English words

.ﺔﯿﺑﺮﻌﻟا تﺎﻤﻠﻜﻟا

Slide 40

Slide 40 text

English words in this paragraph. .تﺎﻤﻠﻜﻟ Some more LTR words, same paragraph.

Slide 41

Slide 41 text

SYSTEMS LIKE LATIN SYSTEMS LIKE ARABIC block direction inline direction block direction inline direction

Slide 42

Slide 42 text

... Example: Writing Mode 1A

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

unicode-bidi

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

“ — The Writing Modes Spec Authors should not use `unicode-bidi`.

Slide 47

Slide 47 text

youtube.com/watch?v=XgqP0qogg6U fantasai.inkedblade.net/style/talks/bidi/

Slide 48

Slide 48 text

SYSTEMS LIKE LATIN SYSTEMS LIKE ARABIC block direction inline direction block direction inline direction

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

SYSTEMS LIKE MONGOLIAN block direction inline direction

Slide 53

Slide 53 text

SYSTEMS LIKE MONGOLIAN block direction inline direction

Slide 54

Slide 54 text

HAN-BASED SYSTEMS block direction inline direction *Chinese, Japanese, Korean & more

Slide 55

Slide 55 text

HAN-BASED SYSTEMS block direction inline direction block direction inline direction *Chinese, Japanese, Korean & more

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

HAN-BASED SYSTEMS block direction inline direction block direction inline direction *Chinese, Japanese, Korean & more

Slide 60

Slide 60 text

writing-mode

Slide 61

Slide 61 text

THREE OPTIONS FOR WRITING-MODE writing-mode: vertical-lr; writing-mode: vertical-rl; toggle w/ dir writing-mode: horizontal-tb;

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

HAN-BASED SYSTEMS *Chinese, Japanese, Korean & more writing-mode: horizontal-tb; writing-mode: vertical-rl;

Slide 64

Slide 64 text

chenhuijing.com/zh-type

Slide 65

Slide 65 text

chenhuijing.com/blog/chinese-web-typography

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

HAN-BASED SYSTEMS *Chinese, Japanese, Korean & more writing-mode: horizontal-tb; writing-mode: vertical-rl;

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

h1:nth-child(2) { writing-mode: vertical-rl; }

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

h1:nth-child(2) { writing-mode: ???; }

Slide 73

Slide 73 text

1) text flowing 2) like this writing-mode: vertical-rl;

Slide 74

Slide 74 text

NOPE! 1) text flowing 2) like this writing-mode: vertical-lr; 1) text flowing 2) like this writing-mode: vertical-rl;

Slide 75

Slide 75 text

2) like this 1) text flowing 1) text flowing 2) like this SYSTEMS LIKE MONGOLIAN HAN-BASED SYSTEMS

Slide 76

Slide 76 text

SYSTEMS LIKE MONGOLIAN

Slide 77

Slide 77 text

SYSTEMS

Slide 78

Slide 78 text

Block Start Top of Horizontal scripts hello A

Slide 79

Slide 79 text

2) like this 1) text flowing 1) text flowing 2) like this SYSTEMS LIKE MONGOLIAN HAN-BASED SYSTEMS

Slide 80

Slide 80 text

section { writing-mode: vertical-rl; } (This triggers text-orientation: mixed as the default.) Example: Writing Mode 1A

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

section { writing-mode: vertical-lr; } Example: Writing Mode 1A

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

THREE OPTIONS FOR WRITING-MODE direction block inline direction writing-mode: vertical-lr; block direction inline direction writing-mode: vertical-rl; block direction inline direction toggle w/ dir writing-mode: horizontal-tb; creates a vertical typographic mode

Slide 85

Slide 85 text

TWO MORE (FUTURE) OPTIONS FOR WRITING-MODE block direction inline direction writing-mode: sideways-lr; block direction inline direction writing-mode: sideways-rl; creates a horizontal typographic mode only A A

Slide 86

Slide 86 text

section { writing-mode: sideways-rl; } Example: Writing Mode 1A

Slide 87

Slide 87 text

section { writing-mode: sideways-lr; } Example: Writing Mode 1A

Slide 88

Slide 88 text

block direction inline direction writing-mode: sideways-rl; block direction inline direction writing-mode: vertical-rl; A ෈

Slide 89

Slide 89 text

direction block inline direction writing-mode: vertical-lr; block direction inline direction writing-mode: sideways-lr; A

Slide 90

Slide 90 text

creates a vertical typographic mode THREE OPTIONS FOR WRITING-MODE direction block inline direction writing-mode: vertical-lr; block direction inline direction writing-mode: vertical-rl; block direction inline direction toggle w/ dir writing-mode: horizontal-tb;

Slide 91

Slide 91 text

My Cool Website

Slide 92

Slide 92 text

My Cool Website how?

Slide 93

Slide 93 text

My Cool Website writing-mode: vertical-rl; transform: rotate(180deg); text-orientation: sideways; (needed to fix punctuation / underlining) text-align: right;

Slide 94

Slide 94 text

text-orientation

Slide 95

Slide 95 text

HAN-LIKE SYSTEMS ෈

Slide 96

Slide 96 text

No content

Slide 97

Slide 97 text

options for vertical writing modes text-orientation: mixed; text-orientation: upright; text-orientation: sideways; THREE OPTIONS FOR TEXT-ORIENTATION

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

section { writing-mode: vertical-rl; text-orientation: upright; } Example: Writing Mode 1A

Slide 101

Slide 101 text

section { writing-mode: vertical-lr; text-orientation: upright; } Example: Writing Mode 1A

Slide 102

Slide 102 text

block direction inline direction writing-mode: sideways-rl; block direction inline direction writing-mode: vertical-rl; text-orientation: mixed; creates a horizontal typographic mode creates a vertical typographic mode

Slide 103

Slide 103 text

My Cool Website writing-mode: vertical-rl; transform: rotate(180deg); text-orientation: sideways; (needed to fix punctuation / underlining) text-align: right;

Slide 104

Slide 104 text

h1 { writing-mode: vertical-rl; } Example: Writing Mode 4A

Slide 105

Slide 105 text

h1 { writing-mode: vertical-rl; transform: rotate(180deg); text-align: right; text-orientation: sideways; } Example: Writing Mode 4B

Slide 106

Slide 106 text

h1 { writing-mode: vertical-rl; text-orientation: upright; text-transform: uppercase; } Example: Writing Mode 4C

Slide 107

Slide 107 text

h1 { writing-mode: vertical-rl; text-orientation: upright; text-transform: uppercase; transform: rotate(180deg); } Example: Writing Mode 4D

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

No content

Slide 110

Slide 110 text

Made by Few

Example: Writing Mode 3A

Slide 111

Slide 111 text

h1 span:nth-child(2) { writing-mode: vertical-rl; text-orientation: upright; font-size: 45%; } Example: Writing Mode 3A

Slide 112

Slide 112 text

h1 { display: grid; } h1 span:nth-child(1) { grid-column: 1 / 3; grid-row: 1 / 2; } h1 span:nth-child(2) { grid-column: 1 / 2; grid-row: 2 / 3; } h1 span:nth-child(3) { grid-column: 2 / 3; grid-row: 2 / 3; } Example: Writing Mode 3A

Slide 113

Slide 113 text

SUMMARY

Slide 114

Slide 114 text

block direction inline direction Acharacter orientation

Slide 115

Slide 115 text

SYSTEMS LIKE LATIN A

Slide 116

Slide 116 text

SYSTEMS LIKE ARABIC A

Slide 117

Slide 117 text

HAN-LIKE SYSTEMS *Chinese, Japanese, Korean & more ෈ ෈

Slide 118

Slide 118 text

MONGOLIAN-LIKE SYSTEMS

Slide 119

Slide 119 text

dir writing-mode text-orientation

Slide 120

Slide 120 text

SYSTEMS LIKE LATIN SYSTEMS LIKE ARABIC block direction inline direction block direction inline direction A A

Slide 121

Slide 121 text

THREE OPTIONS FOR WRITING-MODE direction block inline direction writing-mode: vertical-lr; block direction inline direction writing-mode: vertical-rl; block direction inline direction toggle w/ direction writing-mode: horizontal-tb; creates a vertical typographic mode ෈ ෈ A

Slide 122

Slide 122 text

TWO MORE (FUTURE) OPTIONS FOR WRITING-MODE block direction inline direction writing-mode: sideways-lr; block direction inline direction writing-mode: sideways-rl; creates a horizontal typographic mode only A A

Slide 123

Slide 123 text

options for vertical writing modes text-orientation: mixed; text-orientation: upright; text-orientation: sideways; THREE OPTIONS FOR TEXT-ORIENTATION

Slide 124

Slide 124 text

Start & End

Slide 125

Slide 125 text

block inline

Slide 126

Slide 126 text

block end inline start inline end block start

Slide 127

Slide 127 text

block end inline start inline end block start

Slide 128

Slide 128 text

block start inline end inline start block end

Slide 129

Slide 129 text

end start end start

Slide 130

Slide 130 text

Logical Properties

Slide 131

Slide 131 text

margin-block-start: 1rem; padding-inline-end: 1rem; border-block-end: 1px solid black; text-align: start; float: inline-start;

Slide 132

Slide 132 text

No content

Slide 133

Slide 133 text

drafts.csswg.org/css-logical

Slide 134

Slide 134 text

Alignment

Slide 135

Slide 135 text

w3.org/TR/css-align-3

Slide 136

Slide 136 text

from CSS Tricks’ Complete Guide to Flexbox

Slide 137

Slide 137 text

No content

Slide 138

Slide 138 text

Justify vs. Align

Slide 139

Slide 139 text

block inline

Slide 140

Slide 140 text

start center end s t r e t c h Align

Slide 141

Slide 141 text

Align

Slide 142

Slide 142 text

start center end s t r e t c h Justify

Slide 143

Slide 143 text

Justify

Slide 144

Slide 144 text

cross axis main axis flex-direction: row;

Slide 145

Slide 145 text

cross axis main axis Justify Align flex-direction: row;

Slide 146

Slide 146 text

main axis Justify cross axis Align flex-direction: column;

Slide 147

Slide 147 text

Grid Justify 1 4 5 2 3 6 8 7 9 Align writing-mode: horizontal-tb; grid-auto-flow: row;

Slide 148

Slide 148 text

Grid Justify 1 4 5 2 3 6 8 7 9 writing-mode: horizontal-tb; grid-auto-flow: column; Align

Slide 149

Slide 149 text

Align Justify

Slide 150

Slide 150 text

THANKS! jensimmons.com @jensimmons layout.land labs.jensimmons.com