Styling the last row of a grid with CSS selectors
/* The selector: */
li:nth-child(3n+1):nth-last-child(-n+3),
li:nth-child(3n+1):nth-last-child(-n+3) ~ li {
}
/* or, if you only want to style a grid with two or more rows: */
li:nth-child(3n):nth-last-child(-n+4) ~ li {
}