For those who know CSS there is a selector :last-child
that allows you select the last element node and style it.
There is a little bug with the snippet that can be tricky when you try to do a basic example using this selector. If you try this:
div {
height:100px;
background:red;
margin:10px;
}
div:last-child {
background:yellow;
}
<div></div>
<div></div>
It's supposed to work and make the last div
yellow, but if you inspect the element you can see the script
tag is inserted before the </body>
tag close making the last-child
selector useless.
I know this can be solved using another extra container like this:
div {
height:100px;
background:red;
margin:10px;
}
header div:last-child {
background:yellow;
}
<header>
<div></div>
<div></div>
</header>
But it can be frustrating for another user that try to use it and just don't work.