CSS Grid can be used to stack elements

Stack elements easy with display:grid… although you can do the same thing with display:block; — BUT that’s not really what Stefan is doing in this article, instead it’s moving the elements out of the regular content flow and setting them to grid positions that you would have otherwise required absolute positioning to achieve.

I came across the article How to Stack Elements in CSS written by Sarah Dresner and learned that one could use display: grid; to stack element without setting any absolute positioning! 😲

An excerpt from CSS Grid can be used to stack elements

View original article

Subscribe to our Newsletter

Add your email address and receive an email every Friday covering off everything worth knowing about building your websites responsively.