Adding a Favicon to a Static HTML Page

Adding a favicon to a static HTML page

You can make a .png image and then use one of the following snippets between the <head> tags of your static HTML documents:

<link rel="icon" type="image/png" href="/favicon.png"/>
<link rel="icon" type="image/png" href="https://example.com/favicon.png"/>

Add Favicon to Website

Simply put a file named favicon.ico in the webroot.

If you want to know more, please start reading:

  • Favicon on Wikipedia
  • Favicon Generator
  • How to add a Favicon by W3C (from 2005 though)

How to add a favicon to a static webpage made using parcel.js?

At your <head> tag at your html file you can use

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

Favicon for static HTML page

You just create a favicon.ico with your logo or image and upload it to the folder where your index.html (or your default page).

You can easily create favicon (favicon.ico) from this online tools
http://tools.dynamicdrive.com/favicon/

I've used this to generate favicon for my website.
For eg: For my website (mansoor.in) I've uploaded favicon.ico here.

Adding a favicon to website through HTML code

Your Favicon path uses a windows style File path as pointed out in the comments.

Ensure the following

  • favicon1.ico file is present in the package that you are transferring onto the server.
  • Ensure that the file is accessible over http (try using a browser to navigate to it). The path should be something like http://server:port/app-uri/favicon1.ico
  • After that as suggested in one of the comments use a relative path such as ./favicon1.ico in the HTML source.

Also I suggest reading up on the concept of favicon http://www.w3.org/2005/10/howto-favicon



Related Topics



Leave a reply



Submit