Created
March 24, 2020 08:28
-
-
Save greystate/c57e0180f38124f7326700b34885d740 to your computer and use it in GitHub Desktop.
Using currentcolor to style referenced SVG
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
/** | |
* Using currentcolor to style referenced SVG | |
*/ | |
html { | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; | |
} | |
#logobox { | |
display: block; | |
color: blue; | |
} | |
#logobox:hover { | |
color: black; | |
} |
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 to be placed inside <body>…</body> --> | |
<a href="#somewhere" id="logobox"> | |
<svg width="100" height="100" viewBox="0 0 100 100"> | |
<use href="#logo" /> | |
</svg> | |
</a> | |
<svg xmlns="http://www.w3.org/2000/svg"> | |
<symbol id="logo"> | |
<rect width="100" height="100" fill="none" stroke-width="10" stroke="currentcolor" /> | |
<circle cx="20" cy="80" r="25" fill="currentcolor" /> | |
</symbol> | |
</svg> |
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
// alert('Hello world!'); |
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
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment