Created
March 12, 2013 14:03
-
-
Save joyrexus/5143114 to your computer and use it in GitHub Desktop.
Overview of basic CSS selectors.
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
/* basic */ | |
#foo {} /* id */ | |
.bar {} /* class */ | |
a#foo.bar {} /* element attribute combinations */ | |
/* attributes */ | |
#foo a[href] {} /* simple */ | |
#foo a[href=bar] {} /* attribute values */ | |
#foo a[lang|=en] {} /* subcodes */ | |
#foo a[title~=hello] {} /* attribute contains */ | |
#foo a[href^="http://"] {} /* attribute starts with */ | |
#foo a[href$=com] {} /* attribute ends with */ | |
#foo a[href*=twitter] /* {} attribute wildcards */ | |
/* descendants */ | |
#foo a {} /* all descendants */ | |
ul#list > li {} /* direct children */ | |
/* siblings */ | |
span ~ strong {} /* all adjacent */ | |
p + p {} /* immediate adjacent */ | |
/* combos */ | |
div,p {} | |
/* variations */ | |
#foo.bar.baz {} | |
div#baz.thunk a[-data-info*="hello world"] span + strong {} | |
#thunk[title$='huzza'] {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment