Jump to main content

A11Y Style Guide

Buttons

  • A <button> tag does not need anything special to work. Use <button> when you can, but it is possible to use other elements as long as you add role="button" and add JavaScript to replicate the button functionality.
  • Just like links, you can add class="visuallyhidden" with descriptive text to give more context to the button's purpose.
  • If a button contains an <img> element, make sure to set its alt attribute. If it contains an icon, use aria-label to describe the icon instead.
  • You can use <input type="image"> to make a graphical button. It takes a src and alt attribute just like traditional images.
  • Button states are important, not just button styling! If you are only toggling classes to visually manage state of your components, you are likely not appropriately conveying that state to users of assistive technologies.

Button Types

Example button markup Like example button markup

Button States

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).

Primary

$color-cherry
#e00000
$color-ruby
#a51323
$color-sea-glass
#7fffd4
$color-grass
#42dc42
$color-cornflower
#4083ae
$color-navy
#0a3055
$color-ballet-slipper
#ffa0e5
$color-eggplant
#550055

Black, White, Grays

$color-black
#000000
$color-midnight
#464646
$color-manatee
#888b8d
$color-silver
#bbbbbb
$color-alto
#dddddd
$color-gallery
#f4f4f4
$color-alabaster
#f7f7f7
$color-white
#ffffff

Notification

$notification-color-error
#e00000
$notification-color-success
#218003

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.

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...

Read More about mass hysteria in relation to movie quotes

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.

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
Back to top