Subscribe Us

HTML FAVICON

HTML Favicon: Adding Icons to Your Web Pages

HTML Favicon: Adding Icons to Your Web Pages

What is a Favicon?

A favicon (short for "favorite icon") is a small icon that appears in the browser tab, bookmark bar, and other places to help identify your website. It is an important part of your site's branding and can make your website look more professional and recognizable.

How to Add a Favicon

To add a favicon to your HTML page, you use the <link> tag in the <head> section of your HTML document. The <link> tag should include the rel attribute set to "icon" and the href attribute pointing to the location of your favicon file.

Example: Adding a Favicon

Here’s an example of how to add a favicon to your HTML page:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Favicon Example</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a sample page with a favicon.</p>
</body>
</html>

Favicon Formats and Best Practices

Favicons are typically 16x16 or 32x32 pixels in size and can be in .ico, .png, or .gif format. The .ico format is most widely supported across different browsers, but .png is also commonly used. It's a good idea to provide multiple sizes and formats to ensure compatibility across various devices and platforms.

© 2024 HTML Tutorial

No comments