I created an icon and want to make it clickable with link.
I use this code for icon. added href but it didn't work. idk where to add it.
CodePudding user response:
href
is not a standard attribute (like style
or id
), it applies to the a
tag
Why not wrap your SVG in a link (a
) tag?
You can then configure the link to do things like open in a new window.
See more on the a
tag
body {
background: blue;
}
<a style="position:fixed; right:150px; bottom:10px;" href="https://example.com">
<svg xmlns="w3.org/2000/svg" width="24" height="24" style="fill: white;" style="position: fixed; left: 24px; top: 24px;" viewBox="0 0 24 24"><path d="M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z"/></svg>
</a>