Skip to content

Instantly share code, notes, and snippets.

@basvasilich
Forked from tyv/dabblet.css
Created November 8, 2012 13:34
Show Gist options
  • Save basvasilich/4038831 to your computer and use it in GitHub Desktop.
Save basvasilich/4038831 to your computer and use it in GitHub Desktop.
E:nth-child(an+b)
/*
E:nth-child(an+b)
разбивает все E-элементы
на a-групп (остаток в последней)
выделает b-элемент в каждой
E:nth-last-child(an+b)
тоже самое но с конца коллекции элементов
могут принимать значения odd (=2n+1)
и even (2n)
*/
.parent li:nth-child(3n+1)
{
border: 1px solid red;
}
<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>
<li class="child child06">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