There is no such thing as one-size-fits-all styling. An image gallery with three images might need to be styled differently than an image gallery with twelve. There are some cool tricks that you can use to add some number-based logic to your CSS! Using
:nth-last-child, you can get some surprisingly complex information without ever leaving your stylesheet.
This post will assume that you have a basic understanding of how the
:nth-child pseudo-selector works. If you need a …