Skip to content

Instantly share code, notes, and snippets.

@josephspurrier josephspurrier/color.php
Last active Aug 29, 2015

Embed
What would you like to do?
CSS Style Selectors for Color
<!DOCTYPE HTML>
<html>
<style>
* {
color: white;
}
p {
color: green;
}
p span {
color: palegreen;
}
p > span {
color: gold;
}
span:last-child {
color: gray;
}
span:nth-child(4) {
color: silver;
}
span {
color: orange;
}
.class {
color: black;
}
.class2 {
color: cyan;
}
span.class {
color: pink;
}
span[style] {
color: brown;
}
#id {
color: red;
}
</style>
<body>
<p style="color: green;">
Hello <!-- Green -->
<span>and</span> <!-- Gold -->
<span class="class2 class">good</span> <!-- Pink -->
<span class="class" id="id" style="">morning</span> <!-- Red -->
<span class="class" id="id" style="color: blue;">world</span> <!-- Blue -->
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.