Skip to content

Instantly share code, notes, and snippets.

@michsch
Last active January 4, 2016 16:15
Show Gist options
  • Save michsch/5570267 to your computer and use it in GitHub Desktop.
Save michsch/5570267 to your computer and use it in GitHub Desktop.
CSS nested selectors
/**
* CSS nested selectors
*/
body {
font-family: Arial, verdana, sans-serif;
font-size: 20px;
color: black;
}
.content .rot {
color: #ff0000;
}
.link-with-icon-wrapper {
width: 200px;
}
.link-with-icon {
display: block;
text-align: center;
text-decoration: none;
}
.link-with-icon:after {
content: '↓';
display: block;
}
<div class="content">
<p>Dieser Text ist schwarz!</p>
<p class="rot">Dieser Text ist rot!</p>
<p class="link-with-icon-wrapper"><a class="link-with-icon" href="#">Mein Link</a></p>
</div>
<p class="rot">Dieser Text ist schwarz, auch wenn er die Klasse "rot" hat.</p>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment