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
/* самый распространенный: все потомки */ | |
.parent .child | |
{ | |
aborder: 1px solid red; | |
} | |
/* | |
все селекторы можно уточнять | |
именами элементов ol.parent li.child | |
*/ |
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
/* | |
E:nth-of-type(an+b) | |
тоже самое, но работает только с группой E-элементов | |
p:nth-child(2) | |
это параграф && это второй элемент своего родителя | |
p:nth-of-type(2) | |
это второй параграф своего родителя | |
http://css-tricks.com/the-difference-between-nth-child-and-nth-of-type/ |
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
/* | |
E:nth-child(an+b) | |
разбивает все E-элементы | |
на a-групп (остаток в последней) | |
выделает b-элемент в каждой | |
E:nth-last-child(an+b) | |
тоже самое но с конца коллекции элементов | |
могут принимать значения odd (=2n+1) |
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; | |
} |
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
/* | |
любые стили для :visited | |
отключены в webkit по | |
соображениям безопастности | |
*/ | |
:visited | |
{ | |
/* разрешается менять только color */ | |
color: red; | |
} |
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
#i-am-a-target:target | |
{ | |
color: red; | |
} |
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
input + label | |
{ | |
color: green; | |
} | |
input:checked + label | |
{ | |
color: red; | |
} |
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
p:first-line, | |
span:first-line /* не работает у строковых элементов */ | |
{ | |
font-size: 200%; | |
} | |
p:first-letter, | |
span:first-letter /* но почему не работает тут?! upyachka.gif */ | |
{ | |
color: red; |
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
.i:before | |
{ | |
content: 'before '; | |
color: green; | |
} | |
.i:after | |
{ | |
content: ' after'; | |
color: red; |
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
form input[type="checkbox"]:disabled + label | |
{ | |
color: #ccc | |
} | |
form input[type="checkbox"]:not(:disabled) | |
{ | |
font-size: 150%; | |
} |