select second child css code example

Example 1: css odd even child

tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}

Example 2: nth-child() 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;
}

Example 3: second child css

.YourElementsClass:nth-child(2) {
  /* your styles */
}

Example 4: select even child css

li:nth-child(even) { /* Selects only even elements */
    color: green;   
}

Example 5: css nth-child

/* Select the first list item */
li:nth-child(1) { }
/* Select odd list items */
li:nth-child(odd) { }
/* Select even list items */
li:nth-child(even) { }
/* Select each list item every 3 (3,6,9...) */
li:nth-child(3n) { }
/* Select each list item every 3 starting from the fourth (4,7,10...) */
li:nth-child(3n+1) { }

Example 6: how select two nt child with css

//Separate the classes with a comma ,

.ListTaskTime tbody tr >td:nth-child(3), 
.ListTaskTime tbody tr >td:nth-child(6),
.ListTaskTime tbody tr >td:nth-child(9) {
    /* Common Styles Goes Here, Styles will apply to child 3,6 and 9 */
}

Tags:

Css Example