Home >Web Front-end >HTML Tutorial >Detailed explanation of the rel attribute of the tag

Detailed explanation of the rel attribute of the tag

巴扎黑
巴扎黑Original
2017-06-27 13:27:302571browse

The

2cdf5bf648cf2f33323966d7f58a7f3f tag defines the relationship between the current document and other documents in the Web collection. The link element is an empty element that contains only attributes. This element can only exist in the head section, but it can appear any number of times. In HTML, the 2cdf5bf648cf2f33323966d7f58a7f3f tag does not have a closing tag. In XHTML, the 2cdf5bf648cf2f33323966d7f58a7f3f tag must be closed properly.

In addition to the standard general attributes of HTML, the link element also includes many optional attributes: charset, href, hreflang, media, rel, rev, target, title and type. Among these attributes, target is only allowed to be used in two DTDs: Transitional and Frameset. Others can be used in three DTDs: Strict, Transitional and Frameset.

Among these attributes, the rel attribute is the core. Search engines can use this attribute to obtain more information about the link. (1)

stylesheet

-- Calling an external style sheetThis attribute is the most commonly used and is used to call a style sheet, as shown below:

<link rel="stylesheet" href="http://blog.yunlives.com/style.css" type="text/css" media="screen" />

Where href is the URL of the target document, type specifies the MIME type of the target URL, and media specifies the device on which the document will be displayed


media: ["screen": indicates the display device ; "

print

": indicates the printing device;].
(2)

icon -- Define the website favorite icon

<link rel="shortcut icon" href="http://blog.yunlives.com/images/favicon.ico" type="images/x-icon"/>
<link rel="icon" href="http://blog.yunlives.com/images/favicon.png" type="images/png"/>
icon attribute specifies the title bar, address bar, and collection bar small icons


Note: 1. IE only supports favicon in ico format; 2. The rel attribute must contain shortcut to be displayed under IE;


##(3)

canonical

-- Specifies the canonical version of the URL

<link rel="canonical" href="http://blog.yunlives.com?page=3/" />
The canonical attribute is used to let the

search

engine know which of the duplicate or similar web pages in the current website is the page that the webmaster wants it to be. Captured and included.


##(4)
author

-- Declaration of document author


(5)
home

-- Connect to the home page of the site

(6) search -- Search tool that links to the document

(7) sidebar -- Links to the document that should be displayed in the browser sidebar

(8 ) friend -- Friendly link


##Reference link:

http: //www.cnblogs.com/aNd1coder/archive/2012/05/30/2526359.html

http://www.dreamdu.com/xhtml/attribute_rel/

http://www.w3school.com.cn/jsref/prop_anchor_rel.asp

The above is the detailed content of Detailed explanation of the rel attribute of the tag. 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