Last active
August 6, 2018 17:41
-
-
Save tbogin/23a11e90069c470a927a3c5b62b02ee7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*Selects all h4 within .container, including h4 nested within .container's children elements*/ | |
.container h4 { | |
color: blue; | |
} | |
/*Selects only immediate child h4 of .container. Does not include h4 nested within child elements of .container*/ | |
.container > h4 { | |
color: red; | |
} | |
/*Selects all h3 sibling elements that are preceded by article tag*/ | |
article ~ h3 { | |
color: green; | |
} | |
/*Selects first header sibling that is preceded by article tag*/ | |
article + .header { | |
color: skyblue; | |
} | |
/*Selects anchor element with an attribute that ends in, in this example example, .com*/ | |
a[href$=".com"] { | |
color: red; | |
} | |
/*Selects attribute targeting the beginning of anchor attribute's value*/ | |
img[alt^="A Painting"] { | |
color: orange; | |
} | |
/*Selects attribute containing the word zebra anywhere within the selector*/ | |
div[class*="zebra"] { | |
font-weight: bold; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment