Created
March 27, 2012 03:47
-
-
Save hileon/2212333 to your computer and use it in GitHub Desktop.
CSS3 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
/** | |
* CSS3 selectors | |
*/ | |
p:first-child { | |
color: blue; | |
} | |
p:last-child { | |
color: red; | |
} | |
p:nth-child(2) { | |
color: green; | |
} | |
p:nth-child(3n+1) { | |
font-style: italic; | |
color: black; | |
} | |
p:nth-last-child(2) { | |
color: olive; | |
} | |
img[src*="ogo"] { | |
border: 1px solid red; | |
margin: 0 20px; | |
} | |
div:first-of-type { | |
border: 1px solid cyan; | |
padding: 5px; | |
} | |
article:empty { | |
background: lightgray; | |
width: 100px; | |
height: 20px; | |
margin: 10px 0; | |
} | |
p:not(.tac) { | |
font-weight: bold; | |
text-decoration: underline; | |
} | |
article ~ div { | |
background: yellow; | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<article>Blah</article> | |
<article></article> | |
<div> | |
<p class="tac">Un</p> | |
<p class="tac">Dos</p> | |
<p class="tic">Tres</p> | |
<p class="tac">Quatre</p> | |
</div> | |
<div> | |
<img src="logo-un.jpg"> | |
<img src="logo-dos.jpg"> | |
</div> |
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
{"view":"separate","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment