Created
July 2, 2013 05:03
-
-
Save AbhishekGhosh/5906886 to your computer and use it in GitHub Desktop.
Base64 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
<!--PHP Part--> | |
<?php | |
$str = <<<EOS | |
<?xml version="1.0" ?> | |
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"> | |
<linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%"> | |
<stop offset="0%" stop-color="#6356ff" stop-opacity="1"/> | |
<stop offset="100%" stop-color="#75b6ff" stop-opacity="1"/> | |
</linearGradient> | |
<rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" /> | |
</svg> | |
EOS; | |
$b64 = base64_encode($str); | |
?> | |
<!--CSS Objective--> | |
.element { | |
background:url(data:image/svg+xml;base64,<?php echo $b64 ?>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment