" method in the head tag Just set the web page title bar icon."/> " method in the head tag Just set the web page title bar icon.">

Home  >  Article  >  Web Front-end  >  How to set the webpage title bar icon with css

How to set the webpage title bar icon with css

藏色散人
藏色散人Original
2021-03-01 10:33:367521browse

How to set the title bar icon of a webpage with css: first create an HTML sample file; then pass "" method is used to set the webpage title bar icon.

How to set the webpage title bar icon with css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

How to set the web page title bar icon with css:

The small icon displayed in the browser title bar cannot be set through css, but should be done using HTML tags. The specific method is as follows:

Just add:

<link rel="icon" href="favicon.ico" type="image/x-icon"/>

to the

tag in the html file. Note: The format of the icon in href="" is .ico, and the path can be either relative or absolute.

(Recommended learning: CSS video tutorial)

The example demonstration is as follows:

1. First set up a very simple page, the code is as follows:

How to set the webpage title bar icon with css

The page is displayed as follows. It can be seen that there is no small icon yet:

How to set the webpage title bar icon with css

2. In the first step In the display code, add an icon through (relative path is used as an example).

How to set the webpage title bar icon with css

The page display effect at this time is as follows:

How to set the webpage title bar icon with css

Extended information:

If you want to develop The author needs to create a picture in ico format, name the picture favicon.ico, the pixel size is 16*16, and the colors used must not exceed 16 colors, and then put favicon.ico in the root directory of the website.

In this case, the browser will continue to search the root directory of the website. As soon as it finds the file named favicon.ico, it will display the icon in the visitor's address bar and favorites list. .

The above is the detailed content of How to set the webpage title bar icon with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn