rspec/rules/S5240/css/rule.adoc

56 lines
1.2 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Text should provide enough contrast with its background so that it can be read easily by people with moderately low vision, including colorblind people.
This rule raises an issue when a CSS selector defines both the ``++background-color++`` and ``++color++`` properties with a contrast ratio of less than 4.5:1, which is the contrast required to meet WCAG AA level. It applies only when the selector is not on a heading (``++h1++``, ``++h2++``,...) or ``++title++``
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,css]
2021-04-28 16:49:39 +02:00
----
body {
font-size: 17pt;
}
.myclass {
color: #777; // NonCompliant
background-color: #888;
}
.header h4 {
font-size: 22pt;
}
----
== Resources
2021-04-28 16:49:39 +02:00
* https://www.w3.org/TR/WCAG21/#contrast-minimum[WCAG2 - minimum contrast]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
change background-color or color to increase the contrast ratio
=== Highlighting
"color" property's value
'''
== Comments And Links
(visible only on this page)
=== on 8 Feb 2019, 15:00:05 Nicolas Harraudeau wrote:
Note: The contrast ratio function is defined here: \https://www.w3.org/TR/WCAG20-TECHS/G18.html
endif::env-github,rspecator-view[]