how to tell if an element is the last one in a div in css code example Example: apply css on last child in parent div .parent > *:last-child { background-color: red; }