How to add a browser tab icon (favicon) for a website ? – GeeksforGeeks
A browser tab icon, also known as a favicon is a small image that appears before the title of a webpage in the browser tab or bookmark bar to represent a website. It helps in brand recognition, improves user experience, and makes the website stand out among others. Adding a favicon can help users easily identify your website and differentiate it from other open tabs.
In this article, we will discuss how to add a favicon to a website using HTML. A favicon is a small image that is always displayed next to the page title in the browser tab.
To add a favicon to a website, you need to create an icon file in .ico or .png format, and then reference it in the HTML code:
Approach: Use an existing icon: If you have an existing icon in .ico, .png, or .gif format, you can use it as a favicon. To use an existing icon as a favicon, add the following code to the head section of your HTML document:
<link rel="icon" type="image/png" href="https://www.geeksforgeeks.org/how-to-add-a-browser-tab-icon-favicon-for-a-website/path-to-favicon">
HTML
|
Explanation:
- <link>: This tag is used to link to external resources like stylesheets and favicons.
- rel=”icon”: This attribute indicates that the link points to a favicon.
- type=”image/png”: This attribute specifies the MIME type of the file, which in this case is an icon.
- href=”https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200X200.png”: This attribute points to the location of the icon file. The filename and extension can be changed as needed.
Output:
Stay connected with us on social media platform for instant update click here to join our Twitter, & Facebook We are now on Telegram. Click here to join our channel (@TechiUpdate) and stay updated with the latest Technology headlines. For all the latest Technology News Click Here