Every website you see now has a custom icon. But how could you set an icon like that in HTML?
Asked
Active
Viewed 45 times
0
-
1Does this answer your question? [How to set-up a favicon?](https://stackoverflow.com/questions/18301745/how-to-set-up-a-favicon) – Normal Sep 03 '22 at 04:31
-
[that is already answered here ///](https://stackoverflow.com/questions/4888377/how-to-add-a-browser-tab-icon-favicon-for-a-website) – Yokub Sep 03 '22 at 06:56
1 Answers
0
I assume favicon, the icon in the address bar of the browser and on the left in google search. You need to assign them, something like this
<head>
...
<link rel="icon" type="image/png" href="/img/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/svg+xml" href="/img/favicon.svg" sizes="120x120">
<link rel="icon" type="image/png" href="/img/favicon-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/img/favicon-512x512.png" sizes="512x512">
<link rel="apple-touch-icon" type="image/jpg" href="/img/apple-touch-icon.png">
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
...
</head>

Rohit Gupta
- 4,022
- 20
- 31
- 41
-
Note that the [](https://html.spec.whatwg.org/dev/embedded-content.html#the-link-element) tag does not use and does not need a closing slash and never has in any HTML specification. – Rob Sep 03 '22 at 09:38
-
I have corrected it. I recall adding them when yandex was rejecting the pages because it didn't like the favicons. It turned out that it wanted the first favicon to be 32x32 – Rohit Gupta Sep 03 '22 at 09:59
-
The question is a duplicate and will be closed eventually. You should vote to close it as a duplicate, too. – Rob Sep 03 '22 at 10:14