26
loading...
This website collects cookies to deliver better user experience
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
<circle cx="50" cy="50" r="50"/>
</svg>
<head>
tag you place a <link>
element with the rel
attribute set to “icon” and the href
attribute set to the path where your icon lives.<link rel="icon" href="path/to/favicon.svg"/>
data:image/svg+xml;utf8,
(including that last comma) and pass the whole thing to the href
attribute.<link rel="icon" href="data:image/svg+xml;utf8,<svg...>...</svg>">
<text>
element and emojis are pretty much text, you can put any emoji inside your SVG (it may need some moving around to fit right).<link rel="icon" href="data:image/svg+xml,<svg xmlns="http://w3.org/2000/svg" viewBox="0 0 100 100">
<text y=".9em" font-size="90">💩</text>
</svg>" />
<link rel="icon" href="https://fav.farm/💩" />
<style>
tag to our SVG and use the prefers-color-scheme
media query to change our icon based on the user’s dark mode preferences.<link rel="icon" href="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
<style>
svg {
background: white;
}
circle {
fill: black;
}
@media (prefers-color-scheme: dark) {
svg {
background: black;
}
circle {
fill: white;
}
}
</style>
<circle cx="50" cy="50" r="50"/>
</svg>">
<circle>
directly, but you could just as well use classes. For custom SVGs, you’ll probably need to do that.<style>
tags in the SVG are contained within that XML document, so you don’t have to worry about styles leaking into the rest of your application.26