<link/> Tag Syntax

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet ...?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      ... metadata content ...
      <meta http-equiv="..." content="..."/>
      ... metadata content ...
      <title>My Title</title>
      ... metadata content ...
      <meta name="..." content="..."/>
      ... metadata content ...
   </head>
   <body>
      ... flow content ...
      <meta itemprop="..." content="..."/>
      ... flow content ...
   </body>
</html>
Rules for coding the HTML link element

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

<link/> tag as metadata content
  1. Code any <link> tags in the <head> section of the HTML document where metadata content is expected.
  2. Each link element consists of a standalone <link/> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include a rel attribute within the <link/> tag. The value of the attribute, which is enclosed in double quotes, is the type of relationship between the linked resource and the current document.
  4. Include an href attribute within the <link/> tag with the URL of the external resource.
  5. Include any other attributes of the <link/> tag as appropriate.
  6. Since the link element is a void element, it should always be coded as a self-closing tag terminated with the delimiter string />.
<link/> tag for microdata properties
  1. Code the <link> tag in the <body> section of the HTML document where phrasing content is expected.
  2. The link element consists of a standalone <link/> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Inside the <link> tag, code an itemprop attribute to indicate the link element represents a microdata property. The value of the attribute, which is enclosed in double quotes, is the name or URL of the microdata property.
  4. Inside the <link/> tag, code an href attribute with the value of the microdata property in double quotes.
  5. Include any other attributes of the <link/> tag as appropriate.
  6. Since the <link/> tag is a void element, it should always be coded as a self-closing tag terminated with the delimiter string />.

<link/> Content Model

Contents of the <link/> Tag

Content: Empty. All properties are coded using attributes.

Since the <link/> tag is a void element, it is not allowed to have any content, even HTML comments and therefore should always be coded as a self-closing standalone tag, ending with the delimiters /> rather than just > (<link .../>).