How to add favicon in html?

add favicon in html

Add Comment
  • 1 Answer(s)

    To add a favicon in HTML, you can follow these steps:

    1. Create a favicon image. The favicon image should be a small, square image (usually 16×16 pixels) in ICO, PNG, or GIF format.
    2. Place the favicon image in the root directory of your website.
    3. 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.

    Answered on October 9, 2023.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.