Disallow to use number notation for alpha-values.
/* bad */
.foo {
color: oklch(0 0 0 / 0.5);
opacity: 0.8;
}
/* good */
.foo {
color: oklch(0 0 0 / 50%);
opacity: 80%;
}
Disallow unknown annotations.
/* bad */
a {
color: green !please;
}
/* good */
a {
color: green !important;
}
Require an empty line before at-rules.
/* bad */
a {
}
@media {
}
/* good */
a {
}
@media {
}
Disallow vendor prefixes for at-rules.
/* bad */
@-webkit-keyframes {
0% {
top: 0;
}
}
/* good */
@keyframes {
0% {
top: 0;
}
}
Disallow empty blocks.
Specify modern notation for color-functions.
/* bad */
.foo {
color: oklch(70%, 0.1, 248);
}
/* good */
.foo {
color: oklch(70% 0.1 248);
}
Disallow named colors.
/* bad */
a {
color: black;
}
/* good */
a {
color: oklch(0% 0 0);
}
Disallow hex colors.
/* bad */
a {
color: #333;
}
/* good */
a {
color: oklch(32.11% 0 0);
}
Require an empty line before comments.
/* bad */
a {
}
/* comment */
/* good */
a {
}
/* comment */
Disallow empty comments.
Require whitespace on the inside of comment markers.
Specify a pattern for custom media query names.
/* bad */
@custom-media --fooBar (max-width: 30em);
/* good */
@custom-media --foo-bar (max-width: 30em);
Disallow missing var
function for custom properties.
/* bad */
:root {
--foo: red;
}
a {
color: --foo;
}
/* good */
:root {
--foo: red;
}
a {
color: var(--foo);
}
Specify a pattern for custom properties.
/* bad */
a {
--fooBar: 1px;
}
/* good */
a {
--foo-bar: 1px;
}
Disallow duplicate custom properties within declaration blocks.
Disallow duplicate properties within declaration blocks.
/* bad */
a {
color: pink;
color: orange;
}
Disallow redundant longhand properties within declaration-block.
/* bad */
.foo {
top: 0;
left: 0;
right: 0;
bottom: 0;
}
/* good */
.foo {
inset: 0;
}
Disallow shorthand properties that override related longhand properties.
/* bad */
a {
background-repeat: repeat;
background: green;
}
Limit the number of declarations within a single-line declaration block.
Require an empty line before declarations.
/* bad */
a {
--foo: pink;
top: 5px;
}
/* good */
a {
--foo: pink;
top: 5px;
}
Require quotes for font family names where recommended.
Disallow duplicate names within font families.
Disallow a missing generic family keyword within font families.
/* bad */
a {
font-family: Arial;
}
/* good */
a {
font-family: Arial, sans-serif;
}
Disallow invalid unspaced operator within calc
functions.
/* bad */
a {
top: calc(1px+2px);
}
/* good */
a {
top: calc(1px + 2px);
}
Disallow to use rgb
, rgba
, hsl
, hsla
functions.
Disallow non-standard direction values for linear gradient functions.
Specify lowercase for function names.
/* bad */
a {
width: Calc(5% - 10em);
}
/* good */
a {
width: calc(5% - 10em);
}
Disallow unknown functions.
/* bad */
a {
transform: unknown(1);
}
Require quotes for urls.
/* bad */
a {
background: url(x.jpg);
}
/* good */
a {
background: url('x.jpg');
}
Specify number notation for degree hues.
/* bad */
a {
color: lch(56.29% 19.86 10deg / 15%);
}
/* good */
a {
color: lch(56.29% 19.86 10 / 15%);
}
Specify URL notation for @import
rules.
/* bad */
@import 'foo.css';
/* good */
@import url(foo.css);
Disallow duplicate selectors within keyframe blocks.
/* bad */
@keyframes foo {
0% {
}
0% {
}
}
/* good */
@keyframes foo {
0% {
}
100% {
}
}
Disallow invalid !important
within keyframe declarations.
Specify percentage notation for keyframe selectors.
/* bad */
@keyframes foo {
from {
}
to {
}
}
/* good */
@keyframes foo {
0% {
}
100% {
}
}
Specify a pattern for keyframe names.
/* bad */
@keyframes fooBar {
}
/* good */
@keyframes foo-bar {
}
Disallow units for zero lengths.
/* bad */
a {
top: 0px;
}
/* good */
a {
top: 0;
}
Disallow vendor prefixes for media feature names.
Disallow unknown media feature names.
Specify context notation for media feature ranges.
/* bad */
@media (min-width: 800px) {
}
@media (width >= 800px) {
}
Disallow invalid media queries.
Disallow invalid named grid areas.
Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
/* bad */
#container a {
top: 10px;
}
a {
top: 0;
}
Disallow duplicate @import
rules.
Disallow duplicate selectors.
/* bad */
.foo {
}
.foo {
}
Disallow invalid double-slash comments.
Disallow invalid position @import
rules.
Limit the number of decimal places allowed in numbers to 4.
/* bad */
a {
top: 3.245634px;
}
/* good */
a {
top: 3.2456px;
}
Disallow vendor prefixes for properties.
/* bad */
a {
-webkit-transform: scale(1);
}
/* good */
a {
transform: scale(1);
}
Disallow unknown properties.
Require an empty line before rules.
Disallow unmatchable An+B selectors.
/* bad */
a:nth-of-type(0n + 0) {
}
Require quotes for attribute values.
Specify a pattern for class selectors.
/* bad */
.fooBar {
}
/* good */
.foo-bar {
}
Specify a pattern for id selectors.
/* bad */
#fooBar {
}
/* good */
#foo-bar {
}
Disallow vendor prefixes for selectors.
/* bad */
input::-moz-placeholder {
}
/* good */
input::placeholder {
}
Specify complex notation for :not()
pseudo-class selectors.
/* bad */
:not(a):not(div) {
}
/* good */
:not(a, div) {
}
Disallow unknown pseudo-class selectors.
Disallow unknown pseudo-element selectors.
/* bad */
a::pseudo {
}
Specify double colon notation for applicable pseudo-element selectors.
/* bad */
a:before {
color: pink;
}
/* good */
a::before {
color: pink;
}
Specify lowercase for type selectors.
/* bad */
A {
}
/* good */
a {
}
Disallow unknown type selectors.
tag {
}
Disallow redundant values within shorthand properties.
/* bad */
a {
margin: 1px 1px;
}
/* good */
a {
margin: 1px;
}
Disallow invalid newlines within strings.
Disallow unknown units.
/* bad */
a {
width: 100pixels;
}
Specify lowercase for keywords values.
/* bad */
a {
display: BLOCK;
}
a {
display: block;
}
Disallow vendor prefixes for values.
Disallow out of gamut range colors.
Require to use logical properties and values.
/* bad */
.foo {
max-width: 100%;
}
/* bad */
.foo {
max-inline-size: 100%;
}
Require to use logical units.
/* bad */
.foo {
max-inline-size: 100vw;
}
/* bad */
.foo {
max-inline-size: 100vi;
}