css all but last child code example

Example 1: css select all elements except last css

To give a border to all 'div's except the last one:
div:not(:nth-last-of-type(1)) {
	border-bottom:2px solid #f1f1f1;
}

syntax: 
<html tag name>:not(:nth-last-of-type(n)) {-----}

Example 2: css last child

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

Example 3: css selector every child except last

:not(:last-child)

Example 4: apply css on last child in parent div

.parent > *:last-child {
  background-color: red;
}

Example 5: css selector last child

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