Skip to content

Instantly share code, notes, and snippets.

@boostrack
Last active September 14, 2015 09:48
Show Gist options
  • Select an option

  • Save boostrack/bb265a67f5e327f1ca3a to your computer and use it in GitHub Desktop.

Select an option

Save boostrack/bb265a67f5e327f1ca3a to your computer and use it in GitHub Desktop.
Example of SVG sprites
[[[http://codepen.io/chriscoyier/pen/bc3e029ae8ed05885b33fb03a63a723d]]]
<svg viewBox="0 0 100 100" class="icon shape-codepen">
<use xlink:href="#shape-codepen"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-codepen-2">
<use xlink:href="#shape-codepen"></use>
</svg>
<br>
<svg viewBox="0 0 100 100" class="icon shape-youtube">
<linearGradient id="gradient" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="#FF0000" offset="0"/><stop stop-color="#571C1C" offset="1"/>
</linearGradient>
<use xlink:href="#shape-youtube"></use>
</svg>
<br>
<svg viewBox="0 0 100 100" class="icon shape-twitter">
<use xlink:href="#shape-twitter"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-twitter-2">
<use xlink:href="#shape-twitter"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-twitter-3">
<use xlink:href="#shape-twitter"></use>
</svg>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
.hide {
display: none;
}
.icon {
width: 75px;
height: 75px;
}
body {
padding: 20px;
}
/* Targeting inside only */
.outer-ring {
fill: #999;
}
.inner-logo {
fill: #666;
}
.shape-codepen-2 {
-webkit-filter: drop-shadow(5px 5px 2px #ccc);
filter: drop-shadow(5px 5px 2px black);
}
.shape-youtube {
fill: url(#gradient);
}
.shape-twitter-2 {
fill: #55ACEE
}
.shape-twitter-3 {
fill: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment