, where rel specifies the type and href specifies the resource URL. Common types include stylesheet (CSS), icon (Favicon), font-face (font), preconnect (pre-connection), prefect (prefetch resources)."/> , where rel specifies the type and href specifies the resource URL. Common types include stylesheet (CSS), icon (Favicon), font-face (font), preconnect (pre-connection), prefect (prefetch resources).">
Home > Article > Web Front-end > How to use link tag in html
The link tag in HTML is used to link to external resources, such as CSS files, icons and fonts. The syntax is , where rel specifies the type and href specifies the resource URL. Common types include stylesheet (CSS), icon (Favicon), font-face (font), preconnect (pre-connection), prefect (prefetch resources).
Usage of link tag in HTML
What is link tag?
The link tag is an HTML element used to link external resources (such as CSS files, icons, fonts) into HTML documents.
The syntax of the link tag
<code class="html"><link rel="rel-type" href="source-url"></code>
Among them:
Types of link tags
The link tag can be used to link to different types of external resources. The most common types include:
Using the link tag
To use the link tag, add the following code in the <head>
section:
<code class="html"><head> <link rel="stylesheet" href="style.css"> <link rel="icon" href="favicon.ico"> </head></code>
This code will link the external CSS file style.css
and the favicon favicon.ico
.
Attributes of the link tag
In addition to the rel
and href
attributes, the link tag also supports other attributes, including :
The above is the detailed content of How to use link tag in html. For more information, please follow other related articles on the PHP Chinese website!