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
- Chrome's Color Contrast Analyzer Extension - best way to identify gradients & background images with a site
- Color Blindness Simulator - see how your site looks to a person with one of the various forms of color blindness
- Color Safe - accessible color palettes based on WCAG Guidelines
- Contrast Checker - test color contrast combinations based on WCAG Guidelines
- Firefox's WCAG Contrast Checker Add-on - easiest way to quickly test a site & list CSS problems
- Random A11y Color Palettes - project to try and curate beautiful, random color palettes that are a11y friendly
- Tanaguru Contrast Finder - best way to find close colors that meet WCAG 2.1
WCAG 2.1 Guidelines
1.4.1. Use of Color - Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. (Level A)
1.4.3 Contrast (Minimum) - The visual presentation of text and images of text has a contrast ratio of at least 4.5:1, except for some cases. (Level AA)
Primary
#e00000
#a51323
#7fffd4
#42dc42
#4083ae
#0a3055
#ffa0e5
#550055
Black, White, Grays
#000000
#464646
#888b8d
#bbbbbb
#dddddd
#f4f4f4
#f7f7f7
#ffffff
Notification
#e00000
#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
2.4.7 Focus Visible - Any keyboard operable user interface has a mode of operation where the keyboard focus indicator is visible. (Level AA)
<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
2.4.4 Link Purpose (In Context): The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context, except where the purpose of the link would be ambiguous to users in general. (Level A)
2.4.9 Link Purpose (Link Only): A mechanism is available to allow the purpose of each link to be identified from link text alone, except where the purpose of the link would be ambiguous to users in general. (Level AAA)
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
2.4.1 Bypass Blocks - A mechanism is available to bypass blocks of content that are repeated on multiple Web pages. (Level A)
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
1.4.1. Use of Color - Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. (Level A)
1.4.3 Contrast (Minimum) - The visual presentation of text and images of text has a contrast ratio of at least 4.5:1, except for some cases. (Level AA)
1.4.4 Resize Text - Except for captions and images of text, text can be resized without assistive technology up to 200 percent without loss of content or functionality. (Level AA)
1.4.5 Images of Text - If the technologies being used can achieve the visual presentation, text is used to convey information rather than images of text (some exceptions). (Level AA)
1.4.8 Visual Presentation - For the visual presentation of blocks of text, a mechanism is available to achieve the following (see WCAG guidelines for more info). (Level AAA)
Open Sans Family
Verdana Family
Tahoma Family
Georgia Family
<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!