HTML Link Tag

Reference on the HTML Link Tag. Including its useful example, and a list of the allowed attributes.

The Link element of HTML is used to link external files with a document.

Its most common use, is perhaps, to link external CSS StyleSheets. But it can also be used to link to different translations of a document.

Attributes

Attribute:Value:Description:
AttrsOther AttributesCommon, I18n, Event
CharsetCharacter encodingCharacter encoding of resource
hrefURIURI for linked resource
hreflangLanguage Codelanguage of resource, if href is used.
typeMedia TypeThe Content Type of the resource.
relLink TypesSpace-separated list of forward links
revLink TypesSpace-separated list of reverse links
mediaMedia DescriptorEither a single, or comma-separated list. I.e. "screen,print"

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

  <head>
    <title>Using the HTML Link Tag</title>
    <link rel="stylesheet" type="text/css" href="StyleSheet.css">
  </head>

  <body>
    <p>How to add a Stylesheet using Link</p>

  </body>

</html>

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.