What is the role of the `<link>` tag in HTML, and how is it used?

Instruction: Discuss the purpose and usage of the `<link>` tag.

Context: This question tests the candidate's knowledge of the `` tag in HTML, particularly its role in linking external resources like CSS files.

Official answer available

Preview the opening of the answer, then unlock the full walkthrough.

For example, when we use the <link> tag to connect a CSS stylesheet, we include it within the <head> tag of our HTML document like so: <link rel="stylesheet" href="style.css">. Here, the rel attribute specifies the relationship between the document and the linked resource, which in this case is a stylesheet. The href attribute provides the path to the CSS file. This separation of concerns not only aids in the readability of our HTML document but also enhances its performance by allowing the browser to fetch and load the CSS file asynchronously.

Moreover, the <link> tag plays...

Related Questions