Created
May 22, 2012 08:10
-
-
Save tyv/2767507 to your computer and use it in GitHub Desktop.
:first- |:last- child — любой E,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
:first- |:last- child — любой E, | |
являющийся первым или последним ребенком | |
*/ | |
.parent li:first-child | |
{ | |
border: 3px solid red; | |
} | |
.parent :first-child | |
{ | |
background: yellow; | |
} | |
.parent li.child:first-child | |
{ | |
font-weight: bold; | |
} | |
/* | |
любой первый преставитель своего типа элементов | |
среди братьев | |
*/ | |
.parent li:first-of-type:before | |
{ | |
content: "first of type >> "; | |
} | |
/* | |
выбирает элементы, которые являются единственными | |
вложенными элементами в родителя | |
*/ | |
.parent :only-child:before | |
{ | |
content: "only-child >> "; | |
font-weight: bold; | |
} | |
/* | |
выбирает элементы, которые являются единственными | |
своего типа среди братьев | |
(в том числе и просто единственные у своего родителя) | |
*/ | |
.parent span:only-of-type | |
{ | |
border: 1px dashed; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> | |
<span>span</span> | |
<ul> | |
<li> | |
<div>sublist</div> | |
<span>and span here</span> | |
</li> | |
<li> | |
<span>sublist</span> | |
</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> | |
<li class="child child07">child</li> | |
<li class="child child08">child</li> | |
<li class="child child09">child</li> | |
<li class="child child10">child</li> | |
<li class="child child11">child</li> | |
</ol> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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