Skip to content

Instantly share code, notes, and snippets.

@petevb
Last active May 13, 2019 09:07
Show Gist options
  • Save petevb/9504f32de572a03fea77 to your computer and use it in GitHub Desktop.
Save petevb/9504f32de572a03fea77 to your computer and use it in GitHub Desktop.
[selectors for dummies] #css
/**
* selectors for dummies
*/
/* UNCOMMENT THE .a.a AND IT "TRUMPS" THE .a BELOW IT */
/* I'm first, but have higher specificity (so not overridden)*/
/*.a.a {
color: gold;
}*/
/* A should be blue */
.a {
color: blue;
}
/* I override blue above (to be red), but I can't beat the .a.a */
.a {
color: red;
}
/* only A contained by A will be selected/green */
.a .a {
color: green;
}
.itemsTable td p.tallRow {
color: red;
}
.tallRow.tallRow.tallRow {
color: gold;
}
<div class="a">I'm just A</div>
<hr>
<div class="a">I'm A and container for another A <div class="a" >Contained A</div></div>
<hr>
<div class="a a">I'm A A and container for A<div class="a" >Contained A</div></div>
<hr>
<table class="itemsTable">
<tbody>
<tr>
<td>
<p class="tallRow">omg</p>
</td>
</tr>
</tbody>
</table>
// alert('Hello world!');
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment