rspec/rules/S4647/css/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

52 lines
1.2 KiB
Plaintext

== Why is this an issue?
An invalid color definition will by default be interpreted as black, which is likely to have unintended impacts on the expected look and feel of the website.
This rule raises an issue when a color definition (``++color++``, ``++background-color++``) is not valid. The color definition is considered valid when it is made of hexadecimal characters:
* longhand: 6 or 8 characters (when alpha is defined)
* shorthand variant: 3 or 4 characters (when alpha is defined)
=== Noncompliant code example
[source,css]
----
a {
color: #3c; /* Noncompliant; shorthand should be made of 3 characters */
}
div {
background-color: #3cb371a; /* Noncompliant; alpha should have 2 characters */
}
----
=== Compliant solution
[source,css]
----
a {
color: #3cc;
}
div {
background-color: #3cb371ac;
}
----
== Resources
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value[Mozilla Web Technology for Developers] - CSS Color
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== on 4 Jun 2018, 09:28:19 Ann Campbell wrote:
\[~alexandre.gigleux], there's no "why" here.
endif::env-github,rspecator-view[]