0% completed
In this lesson, you'll learn what favicons are, why they are important, and how to add them to your webpage using HTML.
A favicon (short for "favorite icon") is a small image or icon that represents your website. Favicons appear in several places, such as:
They help users quickly identify your site and add a professional touch to your website.
Favicons are added to your webpage through the <link>
element inside the <head>
section of your HTML document.
Basic Syntax:
<link rel="icon" type="image/png" href="path/to/favicon.png">
rel="icon"
: Specifies that the linked file is a favicon.type="image/png"
: Indicates the file type (could be image/png
, image/gif
, image/x-icon
, etc.).href
: The path to the favicon file.PNG
, GIF
, or ICO
formats. The ICO format is widely supported and can contain multiple sizes.<link>
tags for compatibility with different platforms (like Apple devices). For instance:
<link rel="apple-touch-icon" href="path/to/apple-touch-icon.png">
Below is a complete HTML example that shows how to add a favicon to a webpage:
Explanation:
<link rel="icon">
element in the <head>
section tells the browser where to find the favicon file.type
attribute.Understanding how to add and manage favicons is a small yet essential part of building a well-rounded website. In our next lesson, we'll cover HTML Page Redirection to explore how you can automatically direct users from one page to another.
.....
.....
.....