Skip to content

Instantly share code, notes, and snippets.

@moeriki
Last active August 12, 2020 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moeriki/2989f748dd4a17b553cd89326f997338 to your computer and use it in GitHub Desktop.
Save moeriki/2989f748dd4a17b553cd89326f997338 to your computer and use it in GitHub Desktop.
/* Find images with missing alt attributes */
img:not([alt]) {
outline: 2px dotted red;
}
/* Potential tabindex problems */
[tabindex]:not([tabindex="0"], [tabindex="-1"]) {
outline: 2px dotted red;
}
/* Links that go nowhere */
a:is(:not([href]), [href=""], [href="#"]) {
outline: 2px dotted red;
}
/* Invalid list elements */
:is(ul,ol) > *:not(li) {
outline: 2px dotted red;
}
/* Images without width and height */
img:not([width]):not([height]) {
filter: blur(20px);
}
/* Headers out of order (i.e. h2 before h1, etc.)
Result: dotted blue outline
*/
h2 ~ h1,
h3 ~ h1,
h4 ~ h1,
h5 ~ h1,
h6 ~ h1,
h3 ~ h2,
h4 ~ h2,
h5 ~ h2,
h6 ~ h2,
h4 ~ h3,
h5 ~ h3,
h6 ~ h3,
h5 ~ h4,
h6 ~ h4,
h6 ~ h5 {
outline: 2px dotted red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment