Skip to main content

Lint HTML in CSS

Jun 20, 2020 • 1 min

Linting HTML with CSS is a great tool to help find problematic markup.

This selector hunts for links that have:

  • no href
  • an empty href
  • a "#" href (button perhaps?)
a:is(:not([href]), [href=""], [href="#"]) {
  outline: 2px dotted red;
}

Missing Alt Text

Highlight images missing alt text with:

img:not([alt]) {
  outline: 2px dotted red;
}