- Courses
- HTML
- HTML top level tags
- <link>
- Role of the href attribute in link
What is the role of the href
attribute in the <link>
element?
The href
attribute specifies the URL of the linked resource.
The href
attribute in the <link>
element is crucial as it defines the URL of the external resource being linked. This can be an absolute or relative URL, and it tells the browser where to fetch the resource from. The href
attribute is essential for linking stylesheets, icons, and other resources, ensuring they are correctly loaded and applied to the document.
<link href="style.css" rel="stylesheet" />