Link tag in HTML
- 24-07-2022
- Trung Minh
- 0 Comments
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 rel
and type
attributes to help identify the type of link.
<link href="URL" type="type" rel="rel"/>
Where the 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.
Browser support:
- Chrome
- Firefox
- IE
- Safari
- Opera