What’s an HTML link tag?

Print anything with Printful



The HTML link tag does not define a hyperlink, but links an HTML document to an external document. It is commonly used to link a document to an external style sheet, and contains attributes such as rel, type, and href.

Contrary to what the name suggests, the hypertext markup language (HTML) link tag does not define a hyperlink. Rather, it links an HTML document to an external document. While most often used in connection with a style sheet, a link tag can also link the document to another source, such as a bookmark, table of contents, or chapter. Link tags must be placed within the head tag, a tag located near the beginning of the HTML document. Unlike other tags in HTML, the link tag has a start tag but no end tag.

One of the most common places the link tag is used is when linking a document to an external style sheet. A style sheet is a document that provides information about how the web page should look. The convenience of a style sheet becomes evident when it is used to control the appearance of multiple web pages at once. As long as each page of the website has a link tag to link the page to the style sheet, an author can easily change the look of his website. All he has to do is change the appropriate element in the style sheet and the changes will be reflected on all pages of the website.

There are several attributes that can be contained within a link tag, including the rel, type, and href attributes. The rel relates the connection that the HTML document has to the linked file. For example, rel=”stylesheet” communicates that the linked file is a stylesheet. Other values ​​that can be used with this attribute are previous, next, and alternate values.

Another important attribute that can be included within the link tag is the type attribute. This attribute conveys the type of document that the linked file is. When used in relation to a style sheet, the type will be text/css. Other types of documents include audio, video and images. If you need to enter the location of the external document, you can use the href attribute. This attribute includes the uniform resource locator (url) to the external document.




Protect your devices with Threat Protection by NordVPN


Skip to content