css get last child code example

Example 1: not last child css

p:not(:last-child) { 
	margin-bottom: 20px
}

Example 2: css last child

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

Example 3: remove border from last child css

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

Example 4: selecting last child css

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

Example 5: apply css on last child in parent div

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

Example 6: css selector last child

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

Tags:

Css Example