Colors
- Avoid using color only to communicate information. In the case of links, use another identifier such as bold or underline to indicate a link verses using color alone.
- Some users have difficulty reading text if there is too little contrast between foreground and background. To meet Level AA, text must have a contrast ratio of at least 4.5:1 (or 3:1 for large text). In order to meet the guidelines at the stricter Level AAA, the contrast ratio must be at least 7:1 (or 4.5:1 for large text).
Resources
WCAG 2.1 Guidelines
Primary
$color-cherry
#e00000
#e00000
$color-ruby
#a51323
#a51323
$color-sea-glass
#7fffd4
#7fffd4
$color-grass
#42dc42
#42dc42
$color-cornflower
#4083ae
#4083ae
$color-navy
#0a3055
#0a3055
$color-ballet-slipper
#ffa0e5
#ffa0e5
$color-eggplant
#550055
#550055
Black, White, Grays
$color-black
#000000
#000000
$color-midnight
#464646
#464646
$color-manatee
#888b8d
#888b8d
$color-silver
#bbbbbb
#bbbbbb
$color-alto
#dddddd
#dddddd
$color-gallery
#f4f4f4
#f4f4f4
$color-alabaster
#f7f7f7
#f7f7f7
$color-white
#ffffff
#ffffff
Notification
$notification-color-error
#e00000
#e00000
$notification-color-success
#218003
#218003
<h3>Primary</h3>
<div class="kss-swatch" style="background-color: #e00000">
<div class="kss-swatch__hex">$color-cherry<br>#e00000</div>
</div>
<div class="kss-swatch" style="background-color: #a51323">
<div class="kss-swatch__hex">$color-ruby<br>#a51323</div>
</div>
<div class="kss-swatch" style="background-color: #7fffd4">
<div class="kss-swatch__hex">$color-sea-glass<br>#7fffd4</div>
</div>
<div class="kss-swatch" style="background-color: #42dc42">
<div class="kss-swatch__hex">$color-grass<br>#42dc42</div>
</div>
<div class="kss-swatch" style="background-color: #4083ae">
<div class="kss-swatch__hex">$color-cornflower<br>#4083ae</div>
</div>
<div class="kss-swatch" style="background-color: #0a3055">
<div class="kss-swatch__hex">$color-navy<br>#0a3055</div>
</div>
<div class="kss-swatch" style="background-color: #ffa0e5">
<div class="kss-swatch__hex">$color-ballet-slipper<br>#ffa0e5</div>
</div>
<div class="kss-swatch" style="background-color: #550055">
<div class="kss-swatch__hex">$color-eggplant<br>#550055</div>
</div>
<div class="break"></div>
<h3>Black, White, Grays</h3>
<div class="kss-swatch" style="background-color: #000000">
<div class="kss-swatch__hex">$color-black<br>#000000</div>
</div>
<div class="kss-swatch" style="background-color: #464646">
<div class="kss-swatch__hex">$color-midnight<br>#464646</div>
</div>
<div class="kss-swatch" style="background-color: #888b8d">
<div class="kss-swatch__hex">$color-manatee<br>#888b8d</div>
</div>
<div class="kss-swatch" style="background-color: #bbbbbb">
<div class="kss-swatch__hex">$color-silver<br>#bbbbbb</div>
</div>
<div class="kss-swatch" style="background-color: #dddddd">
<div class="kss-swatch__hex">$color-alto<br>#dddddd</div>
</div>
<div class="kss-swatch" style="background-color: #f4f4f4">
<div class="kss-swatch__hex">$color-gallery<br>#f4f4f4</div>
</div>
<div class="kss-swatch" style="background-color: #f7f7f7">
<div class="kss-swatch__hex">$color-alabaster<br>#f7f7f7</div>
</div>
<div class="kss-swatch" style="background-color: #ffffff">
<div class="kss-swatch__hex">$color-white<br>#ffffff</div>
</div>
<div class="break"></div>
<h3>Notification</h3>
<div class="kss-swatch" style="background-color: #e00000">
<div class="kss-swatch__hex">$notification-color-error<br>#e00000</div>
</div>
<div class="kss-swatch" style="background-color: #218003">
<div class="kss-swatch__hex">$notification-color-success<br>#218003</div>
</div>
Copied!
Link Focus
- Do not set your site's link focus to
outline: none
. Never. Ever. - If you have multiple form fields on your site or you see the dreaded
outline: none
in your base code, you can reset the browser defaults by adding the code:
a:focus { outline: auto 2px Highlight; // for non-webkit browsers outline: auto 5px -webkit-focus-ring-color; // for webkit browsers }
- Of course you can create your own focus styles to match your theme or to make the default browser styles more prominent, just make sure they are visible by tabbing and obvious to your users.
WCAG 2.1 Guidelines
<section class="link-focus-section">
<a href="#">Hey! I'm a cool, focusable link</a>
</section>
Copied!
Read More Links
- Add id selectors to titles or paragraphs and use
aria-labelledby=""
to link to the title text (Example #1). - Add descriptive text with
aria-label=""
directly in the link (Example #2). - Use the class
visuallyhidden
to visually hide more information about the link (Example #3). Note that VoiceOver can cause unintended reading order of visually hidden content in interactive elements. - Turn read more links into buttons, when you can, since they allow for more labeling options.
WCAG 2.1 Guidelines
Example #1: Using aria-labelledby
Storms Hit East Coast
Torrential rain and gale force winds have struck the east coast, causing flooding in many coastal towns. Read More
Example #2: Using aria-label
Black Bears Trapped in Cars
Over the past three weeks there have been 15 reports or black bears getting themselves trapped in vehicles. There are several ways to prevent this from happening to you. Read More
Example #3: Using visually hidden text
Mass Hysteria
Fire and brimstone, coming down from the skies. Rivers and seas boiling... Human sacrifice, dogs and cats, living together...
<section class="read-more-section">
<h3>Example #1: Using aria-labelledby</h3>
<h4 id="headline" class="bold">Storms Hit East Coast</h4>
<p>Torrential rain and gale force winds have struck the east coast, causing flooding in many coastal towns. <a href="#" id="this_link" aria-labelledby="this_link headline" class="read-more">Read More</a></p>
<div class="break"></div>
<h3>Example #2: Using aria-label</h3>
<h4 class="bold">Black Bears Trapped in Cars</h4>
<p>Over the past three weeks there have been 15 reports or black bears getting themselves trapped in vehicles. There are several ways to prevent this from happening to you. <a href="#" aria-label="Read more about trapped black bears" class="read-more">Read More</a></p>
<div class="break"></div>
<h3>Example #3: Using visually hidden text</h3>
<h4 class="bold">Mass Hysteria</h4>
<p>Fire and brimstone, coming down from the skies. Rivers and seas boiling... Human sacrifice, dogs and cats, living together...
<p><a href="#" class="read-more">Read More<span class="visuallyhidden"> about mass hysteria in relation to movie quotes</span></a></p>
</section>
Copied!
Skip Links
- Provide ways for users to skip to important sections of your website. This will help users using screenreaders navigate your site easier and more efficiently.
- There is no real theming rule when it comes to styling your skip links, as such a lot of websites tend to hide them with
class="visuallyhidden"
with a special focus attribute so that sighted keyboard only users are able to see them. - It is important to see that the link points to a valid HTML ID, as often this is overlooked in implementation.
- In this site we have used 'Jump to main content', but other valid examples of "skip" links include:
Skip to content
Skip to main content
Skip to search
Skip to bottom navigation
Skip to main menu
WCAG 2.1 Guidelines
Skip to main content
Hodor hodor; hodor hodor; hodor hodor?! Hodor. Hodor hodor, hodor. Hodor HODOR hodor, hodor hodor... Hodor hodor hodor... Hodor hodor hodor, hodor, hodor hodor. Hodor hodor; hodor hodor; hodor hodor hodor! Hodor hodor hodor - hodor, hodor. Hodor hodor? Hodor! Hodor hodor, hodor hodor hodor... Hodor hodor hodor?!
Heading
This is the first real paragraph. All that other stuff was just plain hodor.
<section class="skip-links-section">
<div class="skip-links">
<a href="#maincontent">Skip to main content</a>
<div class="hodor">Hodor hodor; hodor hodor; hodor hodor?! Hodor. Hodor hodor, hodor. Hodor HODOR hodor, hodor hodor... Hodor hodor hodor... Hodor hodor hodor, hodor, hodor hodor. Hodor hodor; hodor hodor; hodor hodor hodor! Hodor hodor hodor - hodor, hodor. Hodor hodor? Hodor! Hodor hodor, hodor hodor hodor... Hodor hodor hodor?!</div>
<h1><a name="maincontent" id="maincontent"></a> Heading</h1>
<p>This is the first real paragraph. All that other stuff was just plain hodor.</p>
</div>
</section>
Copied!
Typography
- Avoid small font sizes.
- Use relative units for font size, such as ems or rems. While modern browsers can smoothly zoom pixel-based layouts, sizing type in relative units ensures an entire layout can be scaled up or down by simply updating the font-size of the body element.
- A design should allow typography to be magnified up to 200% by the user without clipping or distorting content.
- Select basic, simple, easily-readable fonts and use a limited number of fonts.
- Avoid small font sizes and use relative units for font size (ems or rems).
- Limit the use of font variations such as bold, italics, and ALL CAPITAL LETTERS (caps are similar to screaming to screenreaders).
- Don't rely only on the appearance of the font (color, shape, font variation, placement, etc.) to convey meaning.
- Avoid blinking or moving text.
- Use real text rather than text within graphics.
WCAG 2.1 Guidelines
Open Sans Family
Regular
Italic
Bold
Bold Italic
Verdana Family
Regular
Italic
Bold
Bold Italic
Tahoma Family
Regular
Italic
Bold
Bold Italic
Georgia Family
Regular
Italic
Bold
Bold Italic
<h2>Open Sans Family</h2>
<div style="font: 20px/2 'Open Sans'">Regular</div>
<div style="font: italic 20px/2 'Open Sans'">Italic</div>
<div style="font: bold 20px/2 'Open Sans'">Bold</div>
<div style="font: bold italic 20px/2 'Open Sans'">Bold Italic</div>
<div class="break"></div>
<h2 style="font: 20px/2 'Verdana'">Verdana Family</h2>
<div style="font: 20px/2 'Verdana'">Regular</div>
<div style="font: italic 20px/2 'Verdana'">Italic</div>
<div style="font: bold 20px/2 'Verdana'">Bold</div>
<div style="font: bold italic 20px/2 'Verdana'">Bold Italic</div>
<div class="break"></div>
<h2 style="font: 20px/2 'Tahoma'">Tahoma Family</h2>
<div style="font: 20px/2 'Tahoma'">Regular</div>
<div style="font: italic 20px/2 'Tahoma'">Italic</div>
<div style="font: bold 20px/2 'Tahoma'">Bold</div>
<div style="font: bold italic 20px/2 'Tahoma'">Bold Italic</div>
<div class="break"></div>
<h2 style="font: 20px/2 'Georgia'">Georgia Family</h2>
<div style="font: 20px/2 'Georgia'">Regular</div>
<div style="font: italic 20px/2 'Georgia'">Italic</div>
<div style="font: bold 20px/2 'Georgia'">Bold</div>
<div style="font: bold italic 20px/2 'Georgia'">Bold Italic</div>
Copied!