How to add icon logo in title bar using HTML ?
Last Updated :
25 Jun, 2024
Adding an icon logo in the title bar, commonly known as a favicon, is a simple yet effective way to enhance website recognition and SEO. This small image or icon appears next to the webpage title in the browser’s tab, helping users quickly identify and differentiate between multiple open tabs. By using the <link> tag with the rel attribute set to “icon” and href pointing to the icon file, you can easily display the favicon in the browser tab alongside the title.
Preview Image:

How to Add a Favicon in HTML
To add a favicon, use the following syntax in the <head> section of your HTML document:
Syntax:
<link rel="icon" href="icon_path" type="image/icon type">
Example: This example demonstrates how to add a favicon to your webpage by including the appropriate syntax in the <head> tag of your HTML document.
html
<!-- HTML code to add icon in the title bar -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>GeeksforGeeks icon</title>
<!-- add icon link -->
<link
rel="icon"
href=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200X200.png"
type="image/x-icon"
/>
</head>
<body>
<h1 style="color: green">
GeeksforGeeks
</h1>
<p>
GeeksforGeeks icon added in the title
bar
</p>
</body>
</html>
Output:

Adding a favicon to your webpage is a straightforward process that significantly enhances user experience and website recognition. By including a simple <link> tag in the <head> section of your HTML document, you can ensure that your favicon appears in the browser tab, making it easier for users to identify your site among multiple open tabs.
Please Login to comment...