A favicon (short for “favorite icon”) is an icon that is displayed in the browser’s address bar and tab title for a website. It is used to help users quickly identify the website and distinguish it from other tabs or bookmarks.
<head> <link rel="shortcut icon" type="image/x-icon" href="/path/to/favicon.ico" /> </head>
Favicons originate as small images (usually 16 x 16 pixels) that are added to a
<link> element, which is included in the
<head> of the HTML document.
The following attributes are used in the
<link> element for favicons:
relattribute tells the browser that the linked resource is a favicon; setting to
"shortcut icon"should accommodate most versions of the major browsers.
typeattribute specifies the format of the linked resource (i.e.,
hrefattribute specifies the file path of the favicon file.
Note: The most common file format for favicons are files with the
.icoextension. However, other image formats may be supported depending on the browser (e.g.,
.icofile can be created using an image editor or online converter tool.
With the favicon file and the
link element in the HTML, the favicon should be displayed in the browser’s tab title for the website.
- Anonymous contributor
Learn HTML on Codecademy
Front-End EngineerFront-end engineers work closely with designers to make websites beautiful, functional, and fast.
- Anonymous contributorAnonymous contributor