Skip to content

Instantly share code, notes, and snippets.

@basvasilich
Created November 8, 2012 13:26
Show Gist options
  • Save basvasilich/4038799 to your computer and use it in GitHub Desktop.
Save basvasilich/4038799 to your computer and use it in GitHub Desktop.
самый распространенный: все потомки
/* самый распространенный: все потомки */
.parent .child
{
aborder: solid 3px red
}
/*
все селекторы можно уточнять
именами элементов ol.parent li.child
*/
ol.parent li.child
{
aborder: solid 3px red
}
/* только child */
.parent > .child
{
aborder: solid 3px red
}
/* следующий за */
.child03 + .child
{
abackground: yellow
}
/* после */
.child03 ~ .child
{
abackground: yellow
}
<ol class="parent">
<li class="child child01">child</li>
<li class="child child02">
child
<div class="descendant">descendant</div>
<div class="child">fake child</div>
<ul>
<li>sublist</li>
<li>sublist</li>
</ul>
</li>
<li class="child child03">child</li>
<li class="child child04">child</li>
<li class="child child05">child</li>
</ol>
{"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