How to stack elements on top of each other without absolute positioning

This is extremely useful if you need to preserve height flow, but need to stack elements for the all too common use case of cross fading between elements.

Simply apply relative positioning, float the element, -100% margin left, and left of 100%. Apply clearfix to your parent, and now you have stacked elements that are still contribute to vertical flow.


.configuration-image-wrapper {
@include clearfix;
img {
position: relative;
top: 0;
left: 100%;
margin-left: -100%;
float: left;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s