mishelen
4/9/2015 - 3:36 PM

Quantity Queries

Quantity Queries

// Quantity 6



li:nth-last-child(6):first-child, 
li:nth-last-child(6):first-child ~ li {
  /* rules */
}

// The advantage of :nth-last-of-type(), 
// on the other hand, is that you are able 
// to target groups of like elements 
// where other siblings of different types are present.


// More than or equal to 6


li:nth-last-child(n+6),
li:nth-last-child(n+6) ~ li {
  /* rules */
}

// apply the described technique across different element type siblings

.container > :nth-last-child(n+3),
.container > :nth-last-child(n+3) ~ * {
  /* rules */
}




// Fewer than or equal to 6

li:nth-last-child(-n+6):first-child,
li:nth-last-child(-n+6):first-child ~ li {
  /* rules */
}