Loading...
Loading...
00:00:00

<link> tag in html

The <link> tag in HTML is used to link to external resources, such as CSS stylesheets, JavaScript files, and favicons.

The <link> tag is placed within the <head> section of the HTML document and has several attributes, including href, rel, and type, that specify the relationship between the current document and the linked resource.

Here's an example of how the <link> tag can be used to link to a CSS stylesheet:

<head>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="import" href="component.html">
    <link rel="manifest" href="manifest.json">
</head>

In this example, the <link> tag is used to link to a CSS stylesheet located in a file named "style.css". The rel attribute is set to "stylesheet", indicating that the linked resource is a stylesheet, and the type attribute is set to "text/css", indicating the type of the file being linked. The href attribute specifies the URL of the linked resource.

The <link> tag is a useful tool for separating the presentation of a web page from its content, making it easier to maintain and update the page. By linking to external resources, the HTML document remains cleaner and more focused on its content, while the presentation details are handled by the linked resources.