Change an SVG file through the URL hash
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
/** | |
* Change an SVG file through the URL hash | |
* Warning: Does NOT work on WebKit. | |
*/ | |
body { | |
background: silver; | |
} | |
.logo { | |
width: 100px; height: 100px; | |
background: url('http://lea.verou.me/logo-multicolor.svg#black') no-repeat; | |
} | |
.logo:hover { | |
background-image: url('http://lea.verou.me/logo-multicolor.svg#white'); | |
} | |
.logo:active { | |
background-image: url('http://lea.verou.me/logo-multicolor.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
<h1>Inside an <img>:</h1> | |
<img src="http://lea.verou.me/logo-multicolor.svg" /> | |
<img src="http://lea.verou.me/logo-multicolor.svg#white" /> | |
<img src="http://lea.verou.me/logo-multicolor.svg#black" /> | |
<h1>As a background on a <div>:</h1> | |
<div class="logo"></div> | |
<h1>Through <object> tags:</h1> | |
<object data="http://lea.verou.me/logo-multicolor.svg"></object> | |
<object data="http://lea.verou.me/logo-multicolor.svg#black"></object> | |
<object data="http://lea.verou.me/logo-multicolor.svg#white"></object> |
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":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you know y does this not work on webkit?