Skip to content

Instantly share code, notes, and snippets.

@martinsvoboda
Created December 5, 2019 18:23
Show Gist options
  • Save martinsvoboda/c50cf2f1961228ff60920aab90f23633 to your computer and use it in GitHub Desktop.
Save martinsvoboda/c50cf2f1961228ff60920aab90f23633 to your computer and use it in GitHub Desktop.
SVG icons
<html>
<body>
<style>
.icon {
width: 1.5em;
height: 1.5em;
stroke: currentColor;
stroke-width: 1.5;
stroke-linecap: round;
stroke-linejoin: round;
}
</style>
<script>
(function (doc) {
var scripts = doc.getElementsByTagName('script');
var script = scripts[scripts.length - 1];
var xhr = new XMLHttpRequest();
xhr.onload = function () {
var div = doc.createElement('div');
div.innerHTML = this.responseText;
div.style.width = 0;
div.style.height = 0;
script.parentNode.insertBefore(div, script)
};
xhr.open('get', 'https://citaty.net/static/icons.svg', true);
xhr.send()
})(document)
</script>
<svg class="icon"><use xlink:href="#plus"/></svg>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment