Created
August 8, 2013 09:37
-
-
Save omgmog/6183203 to your computer and use it in GitHub Desktop.
Gracefully degrading stacked thumbnail effect in CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="stackify"> | |
<img src="http://placehold.it/200x200" /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is how it looks:
And without box-shadow support: