Stack

Stack creates elements that are stacked on top of each other with CSS Grid.


Stack elements without position: absolute

Stack uses CSS Grid to stack elements together.

index.html
<div class="Stack">
<div class="Background"> Background </div>
<div> Content </div>
<div class="Foreground"> Foreground </div>
</div>
Background
Content
Foreground
Hover over this to see the stack

The entire stack contains the same height and width

If one layer has more content than others, the entire stack expands in accordance to that layer.

index.html
<div class="Stack">
<div class="Background"> Background </div>
<div> Lots of content ... </div>
<div class="Foreground"> Foreground </div>
</div>
Background
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Corporis reprehenderit facilis ab veniam aut unde pariatur laborum?
Foreground
Hover over this to see the stack

Make complex layouts with stacking elements a cinch

This becomes super easy and doable because Stack elements contains the same height and width.

Backgrounds are also automatically contained within the stack — no overflow headaches!

index.html
<div class="Stack">
<div class="Background"> SVG Background here ... </div>
<div> Content </div>
<div class="Foreground"> Pill #1 </div>
<div class="Foreground"> Pill #2 </div>
</div>
</div>
Note

This example uses Edge to position the pills on the Foreground.

Card Content
Recommended
Don't miss this!
Hover over this to see the stack