HTML <link> Tag Last Updated : 27 Jun, 2024 Comments Improve Suggest changes Like Article Like Report The HTML <link> tag defines the relationship between the current document and an external resource, often for stylesheets or favicons. It's an empty element with attributes like href and rel.Note: The <link> tag also supports the Global Attributes and Event Attributes in HTML.Syntax <link rel="stylesheet" href="styles.css">Attributes valuesAttribute ValueDescriptioncharsetSpecifies the character encoding for the HTML-linked document.crossOriginAssign the CORS (Cross-Origin Resource Sharing) settings of the linked document.disabledSpecifies that the linked document is disabled.hrefSpecifies the URL of the linked document.hreflangSpecifies the language for a linked document.mediaSpecifies what media/device the target resource is optimized for.relSpecifies the relationship between the current and the linked document.revAssigns the reverse relationship from the linked document to the current document.sizesSpecifies the sizes of the icon for visual media; works when rel="icon".targetSpecifies the window or a frame where the linked document is loaded.typeSets/returns the content type of the linked document.HTML link Tag ExamplesExample 1: Basic ImplementationThis example demonstrates the use of the <link> tag to link an external stylesheet and the declaration of the rel and type attributes. HTML <!DOCTYPE html> <html> <head> <title>HTML Link Tag</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body style="background-color: green; color: green;"> <h1>GeeksforGeeks</h1> <h3>HTML Link Tag</h3> <p> A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles. </p> </body> </html> Output:Example 2: Using hreflang AttributeThis example uses the hreflang attribute to specify the language of the linked document and links an external CSS file that styles <h1> tags. HTML <!DOCTYPE html> <html> <head> <title>HTML Link Tag</title> <link rel="stylesheet" type="text/css" href="style.css" hreflang="en-us"> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML Link Tag</h2> </body> </html> CSS h1{ color: green; } Output:HTML link Tag with attributesSupported BrowsersThe browser supported by value attribute in option tag are listed below:Google Chrome 5.0Edge 12 Mozilla 4.0 Safari 5.0 Opera 11.1 Comment More infoAdvertise with us Next Article HTML <link> Tag V Vijay Sirra Follow Improve Article Tags : Web Technologies HTML HTML-Tags Similar Reads HTML <ins> Tag HTML <ins> tag is used to specify a block of inserted text. The <ins> tag is typically used to mark a range of text that has been added to the document. The inserted text is rendered as underlined text by the web browsers although this property can be changed using the CSS text-decoratio 3 min read HTML <i> Tag The <i> tag in HTML is used to display the content in italic style. This tag is generally used to display the technical term, phrase, the important word in a different language. The <i> tag is a container tag that contains the opening tag, content & closing tag.Syntax// Inline way to 3 min read HTML <html> Tag HTML is a language full of diverse elements, and one such element is the <html> tag. This tag, standing for âHyperText Markup Languageâ, is used to define the root of an HTML or XHTML document.It serves as the main container for all other HTML elements, excluding the <!DOCTYPE> declarati 3 min read HTML <nav> Tag The <nav> tag in HTML is used to define navigation sections on a webpage. It typically contains links to key parts of the site, such as the main menu, table of contents, or index. These links are usually organized using unordered lists (<ul>) or displayed as standalone links.Using the 3 min read HTML | <link> target Attribute The HTML <link> target Attribute is used to specify the window or a frame where the linked document is loaded. It is not supported by HTML 5. Syntax: <link target="_blank|_self|_parent|_top|framename"> Attribute Values: _blank: It opens the link in a new window. _self: It is the default 1 min read Like