How to add favicon in html?
To add a favicon in HTML, you can follow these steps:
- Create a favicon image. The favicon image should be a small, square image (usually 16×16 pixels) in ICO, PNG, or GIF format.
- Place the favicon image in the root directory of your website.
- Add the following code to the
<head>
section of your HTML document:
HTML
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
Replace /favicon.ico
with the relative path to your favicon image.
For example, if your favicon image is named favicon.png
and it is located in the root directory of your website, you would add the following code to the <head>
section of your HTML document:
HTML
<link rel="shortcut icon" href="/favicon.png" type="image/png">
Once you have added the favicon code to your HTML document, save the file and upload it to your web server. The favicon will then be displayed in the browser tab and in the search results.