How to use link rel in html

下次还敢
Release: 2024-04-27 21:12:15
Original
430 people have browsed it

The

link tag allows HTML documents to link to external resources such as style sheets, icons, and fonts. The rel attribute specifies the link type. The most common values ​​are: stylesheet: link to the style sheet icon: link to the website icon font: link to the external font file

How to use link rel in html

##Usage of link rel in HTML

Introduction to link tag

In HTML documents, the

tag is used Link documents with external resources such as style sheets, icons, and fonts.

Usage of the rel attribute

#rel The attribute is used to specify the type of link or the resource associated with it. There are several different rel attribute values, the most common of which are:

  • stylesheet: Link to the stylesheet
  • icon: Link to favicon
  • font: Link to external font file

Syntax

The syntax of the tag is as follows:

<code class="html"><link rel="resource-type" href="resource-url" /></code>
Copy after login
Among them:

    ##rel
  • : Specifies the type of link
  • href
  • : Specify the URL of an external resource
Example

Link to a style sheet:

<code class="html"><link rel="stylesheet" href="styles.css" /></code>
Copy after login

Link to favicon:

<code class="html"><link rel="icon" href="favicon.ico" /></code>
Copy after login

Link to external font:

<code class="html"><link rel="font" href="fonts/font.ttf" /></code>
Copy after login

Note# The

##link
    tag is usually placed in the
  • section of the HTML document. Make sure external resources are available on the server.
  • Multiple
  • link
  • tags can link to the same resource type (e.g. multiple style sheets).
  • The optional media
  • attribute can be used to specify media queries to load resources only under certain conditions.

The above is the detailed content of How to use link rel in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template