CSS depends on default colors Accessibility Checkpoint

Description

If you set any of the colors on the body or a elements you must set all of them.

Help

In HTML the color attributes are text, bgcolor, link, alink and vlink. In CSS the attributes are color and background-color. Some users have browser defaults set to white text on a black background, so setting one color without setting the others can result in white text on a white background.

Applicable standards

  • WCAG 2.0 F24 (Success Criteria: 1.4.3 level AA, 1.4.6 level AAA, 1.4.8 level AAA)
  • WCAG 2.1 F24 (Success Criteria: 1.4.3 level AA, 1.4.6 level AAA, 1.4.8 level AAA)
  • WCAG 2.2 F24 (Success Criteria: 1.4.3 level AA, 1.4.6 level AAA, 1.4.8 level AAA)
  • Section 508 (2017) F24 (Success Criteria: 1.4.3 level AA, 1.4.6 level AAA, 1.4.8 level AAA)

Note: Section 508 Refresh (2017) checkpoints are equivalent to WCAG 2.0 level A and level AA checkpoints.

Change history

  • 6.48 Mar 2023 Improved detection.
  • 6.40 Jan 2021 Fixed false positive.
  • 5.39 Nov 2020 Fixed false positive.
  • 5.34 Jul 2019 Improved detection.
  • 5.31 Nov 2018 Fixed false negative.
  • 5.27 Oct 2017 Improved background and text color calculation. Changed rule ID from AccWcag1-2.2.1 to AccHtmlUnsetTextOrBackgroundColor.
  • 5.22 Jul 2016 Fixed false positive on print media.
  • 5.9 Jun 2015 Fixed false positive in CSS.
  • 5.8 Mar 2015 Fixed false negative.
  • 5.4 Feb 2014 Fixed false positive: when background color is set to ’transparent’, treat the same as not set (because ’transparent’ is the default value for background colors).
  • 4.6 Feb 2012 Fixed false positive: don’t warn about setting text colors without setting back color for print CSS rules.
  • 3.5 Dec 2009 Corrected priority.
  • 3.0 Dec 2008 Now triggers WCAG2 issue.
  • 3.0 Dec 2008 Now detects this in CSS rules as well as BODY attributes.
  • 1.0 Feb 2007 Added.

This page describes a web site issue detected in HTML documents by SortSite Desktop and OnDemand Suite.

Rule ID: AccHtmlUnsetTextOrBackgroundColor