*, *:before, *:after { box-sizing: border-box; } @function stack-shadows($length: 10, $x: -1, $y: 1, $color: #000) { $shadow: ''; $i: 0; @for $i from 0 through $length { $shadow: $shadow + ($x * $i) + 'px ' + ($y * $i) + 'px 0 ' + $color; $i: $i + 1; @if $i <= $length { $shadow: $shadow + ', '; } } @return $shadow; } @mixin stacked-shadows($args...) { box-shadow: #{stack-shadows($args...)}; } .container { max-width: 980px; margin: 0 auto; } .brick { text-align: center; text-transform: uppercase; margin: 40px 0; position: relative; } .brick-front { display: inline-block; padding: 20px; border: 4px solid #000; background-color: #fff; position: relative; transition: all .2s ease; transform: translate3d( 0,0,0 ); box-shadow: 0 0 0 0 rgba( 0,0,0,1 ); &:hover { transform: translate3d( 10px,-10px,0 ); @include stacked-shadows(); } } .brick-set { margin: 40px 0; padding: 0; li { position: relative; list-style: none; padding: 0; display: inline-block; width: 50%; &:nth-child(even) { .brick { text-align: left; } } &:nth-child(odd) { z-index: 1; .brick { text-align: right; } } } .brick { margin: 0; .brick-front { transform: translate3d( 10px,-10px,0 ); @include stacked-shadows(); &:hover { transform: translate3d( 0,0,0 ); @include stacked-shadows(0); } } } }