Link tag in HTML
In this article we will learn how to use the link tag in HTML, this is a very important tag, used to add CSS files mainly.
1. What is the link tag in HTML?
The link tag defines a link between an HTML document and an external document, usually CSS files or image files. This tag is very important in SEO, it helps search engines know which links to external links related to the article.
The link tag is usually placed in the head section, it has
type attributes to help identify the type of link.
<link href="URL" type="type" rel="rel"/>
URL is the path to the linked file, the
type is the type of the linked file.
2. How to use the link tag in HTML
Example : Link to style.css file.
<head> <link rel="stylesheet" type="text/css" href="style.css"> </head>
Link to an icon file:
<link rel="shortcut icon" type="image/x-icon" href="public/logo/icon.png?r=1" />
Link tag attributes:
- href – the path to the css file to be linked.
- rel – specifies the relationship between the current document and the linked document.