Here is a helpful article on the topic: https://alistapart.com/article/quantity-queries-for-css
// Targets selector when there are exactly 6 in a row
.selector-name:nth-last-child(6):first-child,
.selector-name:nth-last-child(6):first-child ~ .selector-name {
}