How do I get my page title to have an icon?

HtmlIcons

Html Problem Overview


I would like to have my site’s logo shown in the icon area of the title rather than the default white document. Exactly as Stack Overflow has it.

Html Solutions


Solution 1 - Html

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />

add this to your HTML Head. Of course the file "favicon.ico" has to exist. I think 16x16 or 32x32 pixel files are best.

Solution 2 - Html

this is an interesting question so let check it if you have a image for use as a website-icon then

Add this to your script

   <link rel="icon" type="image/gif" href="animated_favicon1.gif" />

otherwise if you have a icon for your website icon then you chose

 <link rel="shortcut icon" href="favicon.ico" />

I always use http://www.iconspedia.com/ for more icons

if my answer solved your problem then give me vote ok

Solution 3 - Html

They're called favicons, and are quite easy to make/use. Have a read of http://www.favicon.com/ for help.

Solution 4 - Html

Apparently you can use this trick.

<title>📈 My title</title>

That icon-alike is actually a text.

Solution 5 - Html

The accepted answer works perfectly fine. I just want to mention a minor problem with the answer devXen has given.

If you set the icon like this:

<link rel="shortcut icon" type="image/x-icon" href="icon.ico">

The icon will work as expected:

enter image description here

However, if you set it like devXen has suggested:

<title>🧐 Amir A. Shabani</title>

The title of the page moves upon refresh:

enter image description here

So I would advise using <link> instead.

Solution 6 - Html

According to w3school:

<link rel="icon" href="your_icon"/>

Solution 7 - Html

This code will definitely work. In a comment I saw they are using a 'js' syntax that is not for everyone only for those who are working with 'express.js'

<link rel="icon" href="demo_icon.gif" sizes="16x16">
<title> Reddit</title>

you can also add png and jpg

Solution 8 - Html

If using in ruby rails use the below code.

For calculating the path of the file, asset_path function is used to find the image that we are using inside of the rails code embedded in <%= code %>

<link rel="icon" type="image/png" href="<%= asset_path('icon_name.jpg')%>">

Solution 9 - Html

If you wanna use a URL just you can use this code.

<link rel="shortcut icon" type="image/x-icon" href="https://..." />

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionlittlechrisView Question on Stackoverflow
Solution 1 - HtmlNiklasMMView Answer on Stackoverflow
Solution 2 - HtmlanirudhaView Answer on Stackoverflow
Solution 3 - HtmlPaul McLeanView Answer on Stackoverflow
Solution 4 - HtmldevXenView Answer on Stackoverflow
Solution 5 - HtmlAmir ShabaniView Answer on Stackoverflow
Solution 6 - HtmlC.A. Gavin LeeView Answer on Stackoverflow
Solution 7 - HtmlMD SHAYONView Answer on Stackoverflow
Solution 8 - HtmlSunil KumarView Answer on Stackoverflow
Solution 9 - Htmlbehdad setoodeganView Answer on Stackoverflow