nth-last-child css code example

Example 1: css last child

li:last-child {
    background-color: lime;
}

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: css last 3 childs

#something a:nth-last-child(-n+3) {
    /*declarations*/
}

Example 4: remove border from last child css

.menu li:last-child {
  border: none;
}

Example 5: selecting last child css

p:last-child {
  font-size: 0.75em;
}

Example 6: nth-child in css

:nth-child()

Tags:

Css Example