Last active
July 7, 2020 12:48
-
-
Save andi1984/fa0d409d7d6b6cb2fa8fdd561a4ce069 to your computer and use it in GitHub Desktop.
Lint HTML CSS #lintHTMLwithCSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* forbidden nesting */ | |
:not(figure) > figcaption, | |
:not(fieldset) > legend, | |
:not(dl) > :is(dt, dd), | |
:not(tr) > :is(td, th), | |
:not(select) > :is(option, optgroup), | |
:not(table) > :is(thead, tfoot, tbody, tr, colgroup, caption) { | |
outline: 2px dotted red; | |
} | |
/* Button w/o type is a submit button */ | |
button:not([type]) { | |
outline: 2px dotted salmon; | |
} | |
/* unable to infer size OR aspect ratio */ | |
img:not([width]):not([height]) { | |
filter: blur(20px); | |
} | |
/* taborder misuse */ | |
[tabindex]:not([tabindex="0"], [tabindex="-1"]) { | |
outline: 2px dotted red; | |
} | |
/* links go nowhere? */ | |
a:is(:not([href]), [href=""], [href="#"]) { | |
outline: 2px dotted red; | |
} | |
/* 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 blue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment