1StopCoders

Code Examples and Industry News

SASS Box Shadow Mixin

SASS - Created by Casey Martin: 2014-05-16 16:54:00

$vendors: "-moz-", "-webkit-", "-o-", "";
$msvendors: "-ms-", "";

@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
	@if $inset {
    	@each $vendor in $vendors {
			#{$vendor}box-shadow:inset $top $left $blur $color;
		}
  	} @else {
    	@each $vendor in $vendors {
			#{$vendor}box-shadow: $top $left $blur $color;
		}
  	}
	@each $vendor in $msvendors {
		#{$vendor}filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=180, Color='#000000')";
	}
}