首页 > 其他分享 >HTML 27 - Adding Favicon

HTML 27 - Adding Favicon

时间:2024-05-18 19:51:29浏览次数:16  
标签:27 format image favicon HTML Yes Favicon

 

What is a HTML Favicon?

A favicon is a small image that represents your website and helps users identify it among multiple tabs, bookmarks and search results. It can be in various formats, such as ICO, PNG, GIF, JPEG, or SVG, but ICO is the most widely supported format. If you have ever visited a website and noticed a small icon next to the page title in your browser’s tab, you have seen a favicon.

 

In the above figure, we can see the favicon of the Bing official website appear on the top of each tab.

 

How to add a Favicon for a Webpage?

To add a favicon, we need to follow these simple steps mentioned below −

Step 1 − Create or choose an image for your favicon. Its common size could be 16x16 pixels or 32x32 pixels. There are a few online tools available that helps us in creating a favicon such as Favicon.io and ionos.com.

Step 2 − Save and upload the favicon image to the website directory. Make sure the image must be in a format that browsers can recognize, such as PNG, GIF, or ICO.

Step 3 − Now use the <link> element which tells the browser where to find the favicon image. Remember, the <link> tag comes inside the header part i.e. <head> element of HTML document.

Example

The following example illustrates how to create an HTML favicon. We are using the PNG image format.

<!DOCTYPE html>
<html>
<head>
   <title>Tutorialspoint</title>
   <link rel = "icon" type = "image/png" href = "logo2.png">
</head>
<body>
   <h1>Adding Favivon</h1>
   <p>This is an example of including favicon to the web page.</p>
   <p> Favicon will be displayed in the browser tab to the left of the page title.</p>
</body>
</html>

 

Output

The above HTML code will produce the following result −

 

Attributes of <link> element

Following is the list of HTML <link> element attributes that are used while adding a favicon −

S.No.Attributes & Description
1

rel

It specifies the relationship between the current document and the linked resource. For a favicon, its value should be icon.

2

type

It specifies the MIME type of the linked resource. For a favicon, its possible values could be image/x-icon or image/png depending on the format of the image.

3

href

It specifies the URL of the linked resource.

Browser Support for different Favicon File Format

The table below illustrates the various favicon file formats that are supported by different browsers −

BrowserGIFPNGJPEGSVGICO
Chrome Yes Yes Yes Yes Yes
Edge Yes Yes Yes Yes Yes
Safari Yes Yes Yes Yes Yes
Firefox Yes Yes Yes Yes Yes
Opera Yes Yes Yes Yes Yes

标签:27,format,image,favicon,HTML,Yes,Favicon
From: https://www.cnblogs.com/emanlee/p/18190456

相关文章

  • HTML 25 - Input Attributes
     HTMLInputAttributesTheHTMLinputattributesareusedtodefinethecharacteristicsandbehaviorofthe<input>element.Theseattributesareusedwiththedifferenttypesofinputfieldssuchastext,email,password,date,numberandsoforth......
  • HTML 24 - Form Control
     HTMLFormControlsTheformelementsthatareusedtocreatecontrolsfortheuserinteractionwithinthebrowseraretermedasformcontrols.Theyenableuserstoenterinformationfortheserversideprocessing.Thenatureofinteractionwiththeserv......
  • HTML 22 - Forms
     HTMLformsaresimpleformthathasbeenusedtocollectdatafromtheusers.HTMlformhasinteractivecontrolsandvariusinputtypessuchastext,numbers,email,passowrd,radiobutons,checkboxes,buttons,etc.Wecanseeitsapplicationinvarious......
  • HTML 23 - Form Attributes
     WhatareFormAttributes?InHTML,eachelementhasitsownattributesthatareusedtodefinethecharacteristicsofthatparticularHTMLelementandareplacedinsidetheelement'sopeningtag.The<form>elementalsohasattributesthatpr......
  • 全网首一份!你最需要的PPTP MS-CHAP V2 挑战响应编程模拟计算教程!代码基于RFC2759,附全
    本文基于网络密码课上的实验本来想水一水就过去,代码就网上找找,不行就GPT写,但是!一份都找不到,找到的代码都是跑不了的,总会是就是乱七八糟。所以准备认真的写一份。代码编译成功的前提是要预先装好openssl库!本随笔主要有三个内容:编写程序,模拟计算NTResponse、AuthenticatorRespo......
  • HTML 20 - Backgrounds
     Thebackgroundofawebpageisalayerbehinditscontent,whichincludestext,images,colorsandvariousotherelements.Itisanessentialpartofwebdesign,thatimprovestheoveralllookofawebpageaswellasuserexperience.HTMLoffersmultip......
  • HTML 21 - Colors
     HTMLColorsareawayofspecifyingtheappearanceofwebelements.Colorsareveryimportantaspectsofwebdesign,astheynotonlyenhancethevisualappealbutalsoinfluenceuserbehavior.Theyarealsousedtoevokeemotionsandhighlightimportan......
  • LG10270
    思路十分简单,但需要一定的转化,好题。记\(s_{i,j}\)表示第\(i\)行的第\(j\)个字符。考虑任意一点\((i,j)\),假设在此之前没有经过字母不同的路径,若\(s_{i,j+1}\)和\(s_{i+1,j}\)不同,则可以分别往这两个方向走,最长公共前缀也就固定下来了,长度为\(i+j-1\)。于是我们就可......
  • HTML 19 - Text Links
     Awebpagecancontainvariouslinksthattakeusdirectlytootherwebpagesorresourcesandevenspecificpartsofagivenpage.Theselinksareknownashyperlinks.HyperlinksallowvisitorstonavigatebetweenWebsitesbyclickingonwords,phrases......
  • HTML 18 - Lists
     HTMLListisacollectionofrelatedinfomation.Thelistscanbeorderedorunderdereddependingontherequirement.Inhtmlwecancreatebothorderandunorderlistsbyusing<ol>and<ul>tags.Eachtypeoflistcanbedecoratedusingpo......