Adding image to title tag

Hi campers,

I want to add an image to title tag. I am thinking of doing it as below.

    <title> <img  src = "image-url"> </title>

Is it recommended to do it that way?

Nice question, but it’s not possible I believe.

The HTML Title element ( <title> ) defines the document’s title that is shown in a browser’s title bar or a page’s tab. It only contains text; tags within the element are ignored. Source

The way to go is including like so:

<link rel="icon" href="/favicon.ico" />
<!--or also valid formats the following ones: -->
<link rel="icon" type="image/gif" href="/image.gif">
<link rel="icon" type="image/png" href="/image.png">

In the document’s <head> </head> tag.


Some metadata here too…

  • It is called favicon because it is used in the bookmarks when you fav a page. And will also display in the title, as you expect.
  • there is a site to generate favicons (and the tags) for you, I can’t remember which one now but try googling. (edit: i believe I’ve used https://favicon.io/)
1 Like