Contrary to what its name implies, the Hypertext Markup Language (HTML) link tag does not define a hyperlink. Instead, it links an HTML document to an external document. Although most often used in connection with a style sheet, a link tag can also connect the document to another source, such as a bookmark, table of contents, or chapter. Link tags should 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.
Link tags provide connections between the web page and external documents that users of the web page can access.
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 the appearance of the web page. The convenience of a style sheet becomes apparent when it is used to control the appearance of multiple web pages at once. As long as each page on the site has a link tag to connect the page to the style sheet, an author can easily change the look and feel of their site. All you have to do is change the appropriate element in the style sheet and the changes will be reflected on all pages of the site.
There are several different attributes that can be contained in a link tag, including the rel , type , and href attributes. The rel relates the connection of the HTML document to the linked file. For example, rel=”style sheet” communicates that the linked file is a style sheet. Other values that can be used with this attribute are previous, next, and alternate values.
Another important attribute that can be included in the link tag is the type attribute. This attribute passes the document type of the linked file. When used against a style sheet, the type will be text / css . Other types of documents include audio, video, and images. If it is necessary to enter the location of the external document, the href attribute can be used. This attribute includes the uniform resource locator ( url ) for the external document.