nth-dieťa () css
/* Selects the second <li> element in a list */
li:nth-child(2) {
color: lime;
}
/* Selects every fourth element
among any group of siblings */
:nth-child(4n) {
color: lime;
}
css nepárne dieťa
tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}
CSS n-té dieťa
:nth-child(3) { //the number is the child number you are targeting
//styles here
}
dieťa css
p:nth-child(2)
{
background: red;
}
vyberte aj dieťa css
li:nth-child(even) { /* Selects only even elements */
color: green;
}
výber dieťaťa css
/*
Descendant selectors are used to match to any nested element.
Child combinators, on the other hand, only match to the direct
child element and are defined by the greater than symbol.
The selector on the right must be the direct child of the element
on the left.
*/
/* child combinator */
parent > child {...}
/* descendant selector */
parent child {...}
ancestor descendant {...}