Created
August 10, 2011 01:05
-
-
Save cduruk/1135730 to your computer and use it in GitHub Desktop.
Box Shadow
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
/** | |
* Output CSS3 box shadows | |
* | |
* @param string $xOffset The x offset of the shadow | |
* @param string $yOffset The y offset of the shadow | |
* @param string $size Size of the shadow | |
* @param string $opacity You can either specify an opacity value (0 through 1) or a hex color value | |
* @param string $location You can specify this optionally as 'inset' and the shadow will be inside of the element instead of outside | |
* | |
* @return string | |
*/ | |
public function dropShadow($xOffset = 0, $yOffset = 0, $size = 0, $opacity = 0, $location = '') | |
{ | |
if (strstr($opacity, '#')) { | |
$opacity = $opacity; | |
} else { | |
$opacity = "rgba(0, 0, 0, {$opacity})"; | |
} | |
$css = "box-shadow: {$location} {$xOffset} {$yOffset} {$size} {$opacity}; -moz-box-shadow: {$location} {$xOffset} {$yOffset} {$size} {$opacity}; -webkit-box-shadow: {$location} {$xOffset} {$yOffset} {$size} {$opacity};"; | |
return $css; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment