In HTML, what is a Link Tag?

M.R. Anglin

Contrary to what the name implies, the hypertext markup language (HTML) link tag does not define a hyperlink. Rather, it links an HTML document to an external document. Though it is most often used in connection with a style sheet, a link tag can also connect the document to another source, such as a bookmark, index, or chapter. Link tags should be inputted within the head tag, a tag located near the beginning of the HTML document. Unlike some of the other tags in HTML, the link tag has a start tag but no close tag.

Link tags provide connections between the web page and external documents to be accessed by the web page users.
Link tags provide connections between the web page and external documents to be accessed by the web page users.

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

There are several different attributes that can be contained within a link tag, including the rel, type, and href attributes. The rel relates the connection the HTML document has to the linked file. For instance, rel=“stylesheet” communicates that linked file is a stylesheet. Other values that can be used with this attribute are the prev, 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 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 the location of the external document needs to be inputted, the href attribute can be used. This attribute includes the uniform resource locater (url) to the external document.

You might also Like

Discuss this Article

Post your comments
Forgot password?