HTML Tutorial



HTML link tag


HTML <link> Tag

The <link> tag is used to define a relationship between the current HTML document and an external resource. It is most commonly used to link external CSS stylesheets to a webpage. This tag must be placed within the <head> section.


Purpose of <link> Tag

The <link> tag helps in attaching resources like stylesheets, icons, and preconnect hints to a webpage. It plays a crucial role in improving the styling and performance of websites.


Syntax

<link rel="stylesheet" href="style.css">
  

Common Uses

  • Linking external CSS files
  • Adding website favicons
  • Preloading or preconnecting resources

Examples

1. Linking a CSS file:

<link rel="stylesheet" href="styles.css">
  

2. Adding a favicon:

<link rel="icon" href="favicon.ico" type="image/x-icon">
  

Attributes of <link>

  • rel: Specifies the relationship between the current document and the linked resource.
  • href: Specifies the URL of the linked resource.
  • type: Specifies the type of the linked resource (e.g., "text/css").

Conclusion

The <link> tag is a fundamental part of modern web development, allowing developers to apply styles, icons, and more by referencing external resources cleanly and efficiently.


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review