The <link>
tag in HTML is used to define the relationship between the HTML document and external resources such as stylesheets, icons, and other resources. It is typically placed in the <head>
section of the document.
Examples of using the <link>
tag:
- Linking a CSS stylesheet:
<link rel="stylesheet" type="text/css" href="styles.css">
- Adding a site icon (favicon):
<link rel="icon" type="image/png" href="favicon.png">
- Preloading resources:
<link rel="preload" href="image.png" as="image">
The <link>
tag is crucial for organizing and managing site resources, allowing for better optimization and performance.