With great power comes
great responsibility
Uncle Ben
Slide 23
.
}
a11y_1
font-size
{
Slide 24
.
}
a11y_1
font-size
{
Slide 25
Zeit Online 20px
CSS-Tricks 21px
Medium 21px
CSSConf Budapest 20px
Jeffrey Zeldman 24px
Max Böck 22px
Slide 26
h
ps://blog.marvelapp.com/body-text-small/
Slide 27
.
}
a11y_2
line-height
{
Slide 28
.
}
a11y_2
line-height
{
Slide 29
Slide 30
Slide 31
Slide 32
.
}
a11y_3
text-align
{
Slide 33
Slide 34
Slide 35
Slide 36
.
}
a11y_4
paragraph
width
{
Slide 37
Slide 38
Slide 39
D I B S B D U F S T
Q F S M J O F
Slide 40
Slide 41
{ }
p
{
max-width
:
65ch
;
}
ch
represents the width of the glyph „0“ in the element’s
font.
Slide 42
::
}
a11y_5
content
{
Slide 43
Slide 44
{ }
h2::after
{
content
:
"DON'T DO THIS"
;
}
Don’t add text via CSS.
Slide 45
{ }
span
::before {
content
:
"\00d7"
;
}
::before
and
::after
are great for adding icons and symbols
Slide 46
{ }
span
::before {
content
:
"\00d7"
;
}
::before
and
::after
are great for adding icons and symbols
→
Slide 47
Slide 48
Slide 49
{ }
<span
aria-hidden
"true"
class
"icon icon--times"
</span>
Hiding content semantically
Slide 50
.
}
a11y_6
color contrast
{
Slide 51
.
}
a11y_6
color contrast
{
Slide 52
Colors & Color Contrast
Slide 53
Colors & Color Contrast
๏
~285 million people are visually impaire
d
Slide 54
Colors & Color Contrast
๏
~285 million people are visually impaire
d
๏
39 million are blind and 246 million have low vision
Slide 55
Colors & Color Contrast
๏
~285 million people are visually impaire
d
๏
39 million are blind and 246 million have low vision
๏
7 to 12% of men and less than 1% of women have some
form of color-vision deficiency
Slide 56
Colors & Color Contrast
๏
~285 million people are visually impaire
d
๏
39 million are blind and 246 million have low vision
๏
7 to 12% of men and less than 1% of women have some
form of color-vision deficiency
๏
People dim their screens
Slide 57
Colors & Color Contrast
๏
~285 million people are visually impaire
d
๏
39 million are blind and 246 million have low vision
๏
7 to 12% of men and less than 1% of women have some
form of color-vision deficiency
๏
People dim their screens
๏
People use their smartphones outside even when the
sun is shining
Slide 58
[…] enough contrast between text and
its background so that it can be read
by people with moderately low vision
Contrast ratio
๏
1:1
same color for text and background
Slide 61
Contrast ratio
๏
1:1
same color for text and background
๏
1:21
black text on white background and vice versa
Slide 62
Contrast ratio
๏
1:1
same color for text and background
๏
1:21
black text on white background and vice versa
๏
Minimum ratio for normal text less than 24px
4.5:1
Slide 63
Contrast ratio
๏
1:1
same color for text and background
๏
1:21
black text on white background and vice versa
๏
Minimum ratio for normal text less than 24px
4.5:1
๏
Minimum ratio for bold text less than 19px
3:1
Slide 64
Contrast ratio
๏
1:1
same color for text and background
๏
1:21
black text on white background and vice versa
๏
Minimum ratio for normal text less than 24px
4.5:1
๏
Minimum ratio for bold text less than 19px
3:1
๏
Larger text:
3:1
Slide 65
Contrast ratio
๏
1:1
same color for text and background
๏
1:21
black text on white background and vice versa
๏
Minimum ratio for normal text less than 24px
4.5:1
๏
Minimum ratio for bold text less than 19px
3:1
๏
Larger text:
3:1
๏
Level AAA: At least
7:1
and
4.5:1
Slide 66
Slide 67
Slide 68
Slide 69
Slide 70
Slide 71
Slide 72
Slide 73
Slide 74
Slide 75
Use Chrome Canary
2.
Enable experiments: chrome://flags/#enable-devtools-
experiments (copy and paste this internal link into Canary)
3.
From devtools, open se
ings (F1)
4.
Open the experiments panel
5.
Hit shi
$
seven times (no, I'm not kidding)
6.
Check the "Color contrast ratio line in color picker"
h
grid-auto-flow: dense
;
}
grid-auto-flow
tries to fill the gaps in a grid
Slide 142
Slide 143
Slide 144
Slide 145
Slide 146
Properties that affect order
๏
Flexbox (flex-direction, order,…)
๏
position
๏
float
๏
Negative margins
๏
Grid (order, grid-auto-flow, grid-row, grid-column,…)
Slide 147
.
}
a11y_10
progressive
enhancement
{
Slide 148
.
}
a11y_10
progressive
enhancement
{
Slide 149
.
}
a11y_10
progressive
enhancement
{
Slide 150
Slide 151
Slide 152
Slide 153
You Don’t Have To Overwrite Everything
๏
display: inline-block
๏
display: table-cell
๏
vertical-align
๏
column-*
properties
๏
float
…have no effect on grid- or flex-items
Slide 154
.
}
a11y_11
flat structures
{
Slide 155
Slide 156
{ }
<div
class
=
"wrapper"
>
<h2>
Heading
</h2>
<ul>
<li>
Element 1
</li>
<li>
Element 2
</li>
<li>
Element 3
</li>
<li>
Element 4
</li>
<li>
Element 5
</li>
<li>
Element 6
</li>
</ul>
</div>
A
div
with two direct child items (
h2
and
ul
)
Slide 157
{ }
.wrapper {
display
: grid;
grid-template-columns
:
120px
repeat
(2, 1fr);
grid-gap
:
20px
;
}
h2
{
grid-column
:
2
/ -
1
;
}
A grid with 3 columns
Slide 158
Slide 159
{ }
<div
class
=
"wrapper"
>
<h2>
Heading
</h2>
<div>
Element 1
</div>
<div>
Element 2
</div>
<div>
Element 3
</div>
<div>
Element 4
</div>
<div>
Element 5
</div>
<div>
Element 6
</div>
</div>
Don’t fla
#
en the structure of your document and compromise on semantics
!
Slide 160
{ }
ul
{
display
: subg
rid;
}
display: subgrid
didn’t make it into level 1 of the specification.
Slide 161
{ }
ul
{
display
: contents
;
}
display: contents
causes an element's children to appear as if they were direct children of the element's parent
.
Slide 162
Slide 163
{ }
ul
{
display
: grid;
grid-template-columns
:
120px
repeat
(2, 1fr);
grid-gap
:
20px
;
}
Alternative: Defining a nested grid
Slide 164
{ }
ul
{
grid-column
:
1
/ -
1
;
display
: inherit;
grid-template-columns
: inherit;
grid-gap
: inherit;
display
: contents;
}
It’s possible to inherit grid properties
Slide 165
{ }
<div
class
=
"wrapper"
>
<h2>
Heading
</h2>
<div>
Element 1
</div>
<div>
Element 2
</div>
<div>
Element 3
</div>
<div>
Element 4
</div>
<div>
Element 5
</div>
<div>
Element 6
</div>
</div>
Don’t fla
#
en the structure of your document and compromise on semantics!
Slide 166
{ }
Don’t fla
en the structure of your document and compromise on semantics!
Slide 167
Designing with constraints in mind
is simply designing well.
Aaron Gustafson