Created
September 9, 2014 07:31
-
-
Save komplexb/bd0ae5fe50b36ed2640b to your computer and use it in GitHub Desktop.
faking svg as a background: when you embed svg as CSS background, you can't style the elements inside it with external css, this method attempts to do so alternatively
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
<div class="content"> | |
<div class="background-image"> | |
<!-- SVG MARKUP --> | |
</div> | |
</div> |
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
.content { | |
position: relative; //need this so that absolute positioned childern don't escape | |
} | |
.background-image { | |
@include position(absolute, -20px null null -18px); //bourbon mixin | |
@include size(60px); //bourbon mixin | |
z-index: -1; //place in background | |
path { | |
fill: color; //svg bg color | |
opacity: 0.3; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment