Length 9:48Let CSS figure out the layout
About this video
A short CSS tutorial showing how to build a layout that chooses its own number of columns based on how many child elements it contains, using :has(), :nth-child() and :last-child without extra classes or JavaScript. It also covers making the column count configurable and setting an upper limit with :not().
What you’ll learn
- Count child elements in CSS using :has() and :nth-child()
- Set a configurable column count for a grid layout
- Cap the number of columns with :not()
Recommended
Length 9:48
Length 19:43
Length 14:02
Length 19:05
Length 2:40
Length 2:08
Length 9:03
Length 9:18
Length 5:02
Length 4:58
Length 5:21
Length 8:53