Skip to content

Instantly share code, notes, and snippets.

@komplexb
Created September 9, 2014 07:31
Show Gist options
  • Save komplexb/bd0ae5fe50b36ed2640b to your computer and use it in GitHub Desktop.
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
<div class="content">
<div class="background-image">
<!-- SVG MARKUP -->
</div>
</div>
.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