Skip to content

Instantly share code, notes, and snippets.

@omgmog
Created August 8, 2013 09:37
Show Gist options
  • Save omgmog/6183203 to your computer and use it in GitHub Desktop.
Save omgmog/6183203 to your computer and use it in GitHub Desktop.
Gracefully degrading stacked thumbnail effect in CSS
<div class="stackify">
<img src="http://placehold.it/200x200" />
</div>
.stackify {
width: 200px;
padding: 10px;
line-height: 0; /* to fix erroneous space around img */
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid #ddd;
border-bottom-color: #ccc;
-moz-box-shadow:
0px 2px 0 -1px #fff,
0px 3px 0 -1px rgba(0,0,0,0.125),
0px 5px 0 -2px #fff,
0px 6px 0 -2px rgba(0,0,0,0.15),
0px 8px 0 -3px #fff,
0px 9px 0 -3px rgba(0,0,0,0.125),
0px 7px 6px -1px rgba(0,0,0,0.25);
-webkit-box-shadow:
0px 2px 0 -1px #fff,
0px 3px 0 -1px rgba(0,0,0,0.125),
0px 5px 0 -2px #fff,
0px 6px 0 -2px rgba(0,0,0,0.15),
0px 8px 0 -3px #fff,
0px 9px 0 -3px rgba(0,0,0,0.125),
0px 7px 6px -1px rgba(0,0,0,0.25);
box-shadow:
0px 2px 0 -1px #fff,
0px 3px 0 -1px rgba(0,0,0,0.125),
0px 5px 0 -2px #fff,
0px 6px 0 -2px rgba(0,0,0,0.15),
0px 8px 0 -3px #fff,
0px 9px 0 -3px rgba(0,0,0,0.125),
0px 7px 6px -1px rgba(0,0,0,0.25);
}
.stackify img {
max-width: 100%;
height: auto;
}
@omgmog
Copy link
Author

omgmog commented Aug 8, 2013

This is how it looks:

And without box-shadow support:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment