Last Updated: February 25, 2016
·
2.281K
· colegeissinger

Fancy CSS3 Box Shadow with SASS

Written in SCSS, but can easily be converted to pure SASS (http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html)

Copy and paste this mixin into your SASS file and then just add the mixin to any element to add shadows below that element (achieves the folded 3d effect). Make sure you have Compass installed too http://compass-style.org/

@mixin fancy-box-shadow($color:rgba(0,0,0,.5), $left_shadow:-4deg, $right_shadow:4deg, $bottom:8px) {
position:relative;
background:#fff;

&:before, &:after {
    position:absolute;
    width:47%;
    max-width:50%;
    top:80%;
    left:10px;
    bottom:$bottom;
    content:'';
    z-index:-1;
    @include single-box-shadow($color, 0, 15px, 15px);
    @include rotate($left_shadow);
}
&:after {
    right:10px;
    left:auto;
    @include rotate($right_shadow);
}
}

1 Response
Add your response

Hey, you may want to fiddle with your markdown code until you get your @ includes to look ok. Had to do the same with my entry as well. It's trying to convert them to links, as if you're trying to mention someone, like this: @colegeissinger

over 1 year ago ·