A favicon is used as an icon displayed in a browser tab or as a bookmark icon. Having a favicon is important to help users visually identify the website. When we set up a favicon, usually we also set up icons for smartphone home screen shortcuts on Android and iPhone devices.
If you already have an image file for your website favicon, you can set it up in three steps.
There is a special format for favicon files. To create favicon files, you can use favicon converter services. One of the most popular converter services is favicon.io . Go to the website and click on the Converter menu.
Upload your image file. It is better to use a PNG file. If you use an SVG file, you may not get proper image resolution for the favicon files.
When you upload your image, multiple files are created.
Download the converted files onto your local computer and save the files in your website project directory. You can decide where in the project directory you'd like to save them, but you need to properly specify the file paths in the code in the next step.
In this example, we placed the downloaded directory (favicon_io) under the project root directory.
The favicon converter page also generates code for the favicon links. Copy the code and paste the code into the head section of your HTML documents. To display the favicon on all web pages, you need to paste the code into all HTML documents.
When you paste the code, you need to adjust the href
attribute based on your favicon file location. The code that was auto-generated is for the case in which you placed the favicon files in the project root directory.
Go to the favicon.io website, and upload an image file. In this practice, we use the HTML 5 icon.
Download the converted files onto your local computer. Move the downloaded directory to the html-css-introduction directory.
Add the code below to the <head>
section of all the project HTML documents.
<!--Favicon-->
<link rel="apple-touch-icon" sizes="180x180" href="favicon_io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon_io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon_io/favicon-16x16.png">
<link rel="manifest" href="favicon_io/site.webmanifest">
Check a favicon
Check a smartphone shortcut icon
A favicon is used as an icon displayed in a browser tab or as a bookmark icon. Having a favicon is important to help users visually identify the website. When we set up a favicon, usually we also set up icons for smartphone home screen shortcuts on Android and iPhone devices.
If you already have an image file for your website favicon, you can set it up in three steps.
There is a special format for favicon files. To create favicon files, you can use favicon converter services. One of the most popular converter services is favicon.io . Go to the website and click on the Converter menu.
Upload your image file. It is better to use a PNG file. If you use an SVG file, you may not get proper image resolution for the favicon files.
When you upload your image, multiple files are created.
Download the converted files onto your local computer and save the files in your website project directory. You can decide where in the project directory you'd like to save them, but you need to properly specify the file paths in the code in the next step.
In this example, we placed the downloaded directory (favicon_io) under the project root directory.
The favicon converter page also generates code for the favicon links. Copy the code and paste the code into the head section of your HTML documents. To display the favicon on all web pages, you need to paste the code into all HTML documents.
When you paste the code, you need to adjust the href
attribute based on your favicon file location. The code that was auto-generated is for the case in which you placed the favicon files in the project root directory.
Go to the favicon.io website, and upload an image file. In this practice, we use the HTML 5 icon.
Download the converted files onto your local computer. Move the downloaded directory to the html-css-introduction directory.
Add the code below to the <head>
section of all the project HTML documents.
<!--Favicon-->
<link rel="apple-touch-icon" sizes="180x180" href="favicon_io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon_io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon_io/favicon-16x16.png">
<link rel="manifest" href="favicon_io/site.webmanifest">
Check a favicon
Check a smartphone shortcut icon