-
-
Save nofilenamed/6a60f9ad4a264c8bf39c to your computer and use it in GitHub Desktop.
Make SVG clickable in a-tag and with image fallback
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
/** | |
* Make SVG clickable in a-tag and with image fallback (perfect for logotypes) | |
* | |
* HTML: | |
* <a href="http://dystonia-europe.org" target="_blank" class="u--svg-inside"> | |
* <object data="svg-image.svg" type="image/svg+xml"> <img src="fallback-image.png" /> </object> | |
* </a> | |
* | |
*/ | |
.u--svg-inside { | |
position: relative; | |
display: inline-block; | |
&:after { | |
content: ""; | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
} | |
object { | |
width: 100%; // Optional | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment