Last active
June 25, 2020 02:26
-
-
Save yoriiis/4c1a47b13003346810de0b559cd6d45e to your computer and use it in GitHub Desktop.
CSS selectors tips
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
/* | |
* CSS debug tips | |
* Inspired by @argyleink | |
*/ | |
/* Debug images without "width" or "height" attributes */ | |
img:not([width]), img:not([height]) { | |
outline: 2px dotted red; | |
} | |
/* Debug images without "alt" attribute with CSS */ | |
img:not([alt]) { | |
outline: 2px dotted red; | |
} | |
/* Debug lists that have something other than an "<li>" inside */ | |
:is(ul, ol) > *:not(li) { | |
outline: 2px dotted red; | |
} | |
/* Debug links with no "href", an empty "href" or a "#" "href" */ | |
a:is(:not([href]), [href=""], [href="#"]){ | |
outline: 2px dotted red; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment