With great power comes
great responsibility
Uncle Ben
Slide 23
Slide 23 text
.
}
a11y_1
font-size
{
Slide 24
Slide 24 text
.
}
a11y_1
font-size
{
Slide 25
Slide 25 text
Zeit Online 20px
CSS-Tricks 21px
Medium 21px
CSSConf Budapest 20px
Jeffrey Zeldman 24px
Max Böck 22px
Slide 26
Slide 26 text
https://blog.marvelapp.com/body-text-small/
Slide 27
Slide 27 text
.
}
a11y_2
line-height
{
Slide 28
Slide 28 text
.
}
a11y_2
line-height
{
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
.
}
a11y_3
text-align
{
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
No content
Slide 36
Slide 36 text
.
}
a11y_4
paragraph
width
{
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
DIBSBDUFST
QFSMJOF
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
{ }
p {
max-width: 65ch;
}
ch represents the width of the glyph „0“ in the element’s font.
Slide 42
Slide 42 text
::
}
a11y_5
content
{
Slide 43
Slide 43 text
No content
Slide 44
Slide 44 text
{ }
h2::after {
content: "DON'T DO THIS";
}
Don’t add text via CSS.
Slide 45
Slide 45 text
{ }
span::before {
content:"\00d7";
}
::before and ::after are great for adding icons and symbols
Slide 46
Slide 46 text
{ }
span::before {
content:"\00d7";
}
::before and ::after are great for adding icons and symbols
→
Slide 47
Slide 47 text
No content
Slide 48
Slide 48 text
No content
Slide 49
Slide 49 text
{ }
Hiding content semantically
Slide 50
Slide 50 text
.
}
a11y_6
color contrast
{
Slide 51
Slide 51 text
.
}
a11y_6
color contrast
{
Slide 52
Slide 52 text
Colors & Color Contrast
Slide 53
Slide 53 text
Colors & Color Contrast
๏ ~285 million people are visually impaired
Slide 54
Slide 54 text
Colors & Color Contrast
๏ ~285 million people are visually impaired
๏ 39 million are blind and 246 million have low vision
Slide 55
Slide 55 text
Colors & Color Contrast
๏ ~285 million people are visually impaired
๏ 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
Slide 56 text
Colors & Color Contrast
๏ ~285 million people are visually impaired
๏ 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
Slide 57 text
Colors & Color Contrast
๏ ~285 million people are visually impaired
๏ 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
Slide 58 text
[…] enough contrast between text and
its background so that it can be read
by people with moderately low vision
[…]
https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
Slide 59
Slide 59 text
Contrast ratio
Slide 60
Slide 60 text
Contrast ratio
๏ 1:1 same color for text and background
Slide 61
Slide 61 text
Contrast ratio
๏ 1:1 same color for text and background
๏ 1:21 black text on white background and vice versa
Slide 62
Slide 62 text
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
Slide 63 text
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
Slide 64 text
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
Slide 65 text
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 66 text
No content
Slide 67
Slide 67 text
No content
Slide 68
Slide 68 text
No content
Slide 69
Slide 69 text
No content
Slide 70
Slide 70 text
No content
Slide 71
Slide 71 text
No content
Slide 72
Slide 72 text
No content
Slide 73
Slide 73 text
No content
Slide 74
Slide 74 text
No content
Slide 75
Slide 75 text
1. Use Chrome Canary
2. Enable experiments: chrome://flags/#enable-devtools-
experiments (copy and paste this internal link into Canary)
3. From devtools, open settings (F1)
4. Open the experiments panel
5. Hit shift seven times (no, I'm not kidding)
6. Check the "Color contrast ratio line in color picker"
https://remysharp.com/2017/08/17/contrast-ratio-in-devtools
Slide 76
Slide 76 text
No content
Slide 77
Slide 77 text
No content
Slide 78
Slide 78 text
No content
Slide 79
Slide 79 text
No content
Slide 80
Slide 80 text
No content
Slide 81
Slide 81 text
No content
Slide 82
Slide 82 text
No content
Slide 83
Slide 83 text
No content
Slide 84
Slide 84 text
No content
Slide 85
Slide 85 text
Though age has indeed taken its
toll on my eyesight, it turns out that
I was suffering from a design trend.
Kevin Marks
Slide 86
Slide 86 text
@
}
print
{
media a11y_7
Slide 87
Slide 87 text
{ }
@media print {
}
Add the @media declaration block to your CSS for print specific styles
Slide 88
Slide 88 text
{ }
@media print {
}
.header {
position: static;
}
Add the @media declaration block to your CSS for print specific styles
Slide 89
Slide 89 text
{ }
nav {
display: none;
}
@media print {
}
.header {
position: static;
}
Add the @media declaration block to your CSS for print specific styles
Slide 90
Slide 90 text
{ }
body > *:not(main){
display: none;
}
Hiding all children of except for
Slide 91
Slide 91 text
{ }
section {
margin-bottom: 2cm;
font-size: 14pt;
padding: 8mm;
}
Using absolute units for print styles is absolutely fine
Slide 92
Slide 92 text
{ }
a[href^="http"]:not([href*="mywebsite.com"])::after {
content: " (" attr(href) ")";
}
Selecting all links with an absolute link except links to your site
Slide 93
Slide 93 text
{ }
a[href^="http"]:not([href*="mywebsite.com"])::after {
content: " (" attr(href) ")";
}
a[href^="http"]
Selecting all links with an absolute link except links to your site
Slide 94
Slide 94 text
{ }
a[href^="http"]:not([href*="mywebsite.com"])::after {
content: " (" attr(href) ")";
}
:not([href*="mywebsite.com"])
Selecting all links with an absolute link except links to your site
Slide 95
Slide 95 text
{ }
a[href^="http"]:not([href*="mywebsite.com"])::after {
content: " (" attr(href) ")";
}
Selecting all links with an absolute link except links to your site
::after
Slide 96
Slide 96 text
{ }
a[href^="http"]:not([href*="mywebsite.com"])::after {
content: " (" attr(href) ")";
}
" (" attr(href) ")"
Selecting all links with an absolute link except links to your site
Slide 97
Slide 97 text
No content
Slide 98
Slide 98 text
No content
Slide 99
Slide 99 text
:
}
a11y_8
focus
{
Slide 100
Slide 100 text
No content
Slide 101
Slide 101 text
No content
Slide 102
Slide 102 text
{ }
Button
If you need a button, use
Slide 103
Slide 103 text
{ }
Button
If you need a button, use
Button
Slide 104
Slide 104 text
{ }
Button
If you need a button, use
Button
Button
Slide 105
Slide 105 text
No content
Slide 106
Slide 106 text
No content
Slide 107
Slide 107 text
{ }
*:focus {
outline: none;
}
Don’t just remove the default outline (dotted outline, blue or orange ring) without providing alternate styles.
Slide 108
Slide 108 text
No content
Slide 109
Slide 109 text
No content
Slide 110
Slide 110 text
No content
Slide 111
Slide 111 text
No content
Slide 112
Slide 112 text
{ }
input:focus {
outline: 2px solid #000000;
}
:focus pseudo class for custom focus styles
Slide 113
Slide 113 text
No content
Slide 114
Slide 114 text
No content
Slide 115
Slide 115 text
{ }
form:focus-within {
box-shadow: 0 0 4px 6px #000000;
}
:focus-within select an element which has child elements that are currently focused.
Slide 116
Slide 116 text
No content
Slide 117
Slide 117 text
No content
Slide 118
Slide 118 text
No content
Slide 119
Slide 119 text
{ }
:focus {
outline: none;
}
Applying focus styles only for appropriate input modalities
{ }
ul {
}
A grid with as many 180px wide columns as possible
Slide 130
Slide 130 text
{ }
ul {
}
display: grid;
A grid with as many 180px wide columns as possible
Slide 131
Slide 131 text
{ }
ul {
}
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
A grid with as many 180px wide columns as possible
Slide 132
Slide 132 text
{ }
ul {
}
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-gap: 20px;
A grid with as many 180px wide columns as possible
Slide 133
Slide 133 text
{ }
ul {
}
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-gap: 20px;
grid-auto-rows: 180px;
A grid with as many 180px wide columns as possible
{ }
ul {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-gap: 20px;
grid-auto-rows: 180px;
grid-auto-flow: dense;
}
grid-auto-flow tries to fill the gaps in a grid
Slide 142
Slide 142 text
No content
Slide 143
Slide 143 text
No content
Slide 144
Slide 144 text
No content
Slide 145
Slide 145 text
No content
Slide 146
Slide 146 text
Properties that affect order
๏ Flexbox (flex-direction, order,…)
๏ position
๏ float
๏ Negative margins
๏ Grid (order, grid-auto-flow, grid-row, grid-column,…)
Slide 147
Slide 147 text
.
}
a11y_10
progressive
enhancement
{
Slide 148
Slide 148 text
.
}
a11y_10
progressive
enhancement
{
Slide 149
Slide 149 text
.
}
a11y_10
progressive
enhancement
{
Slide 150
Slide 150 text
No content
Slide 151
Slide 151 text
No content
Slide 152
Slide 152 text
No content
Slide 153
Slide 153 text
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