Skip to content

Instantly share code, notes, and snippets.

@vnys
Last active November 23, 2015 10:43
Show Gist options
  • Save vnys/dd651d1df179974044f4 to your computer and use it in GitHub Desktop.
Save vnys/dd651d1df179974044f4 to your computer and use it in GitHub Desktop.
svg circle
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
button {
width: 40px;
height: 40px;
border-radius: 40px;
border: none;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><line id="line" x1="40" y1="100" x2="160" y2="100" stroke="white" stroke-width="15" stroke-linecap="round" /></defs><circle cx="100" cy="100" r="100" fill="silver" /><use xlink:href="%23line" transform="rotate(45 100 100)" /><use xlink:href="%23line" transform="rotate(-45 100 100)" /></svg>');
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sirkel</title>
<style>
button {
width: 40px;
height: 40px;
border-radius: 40px;
border: none;
background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><line id="line" x1="40" y1="100" x2="160" y2="100" stroke="white" stroke-width="15" stroke-linecap="round" /></defs><circle cx="100" cy="100" r="100" fill="silver" /><use xlink:href="%23line" transform="rotate(45 100 100)" /><use xlink:href="%23line" transform="rotate(-45 100 100)" /></svg>');
}
</style>
</head>
<body>
<button></button>
</body>
</html>
@vnys
Copy link
Author

vnys commented Sep 14, 2015

Note! The # is url-encoded. Tested in Safari, Chrome and Firefox on OS X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment