Denoting External Resources

The link element links an HTML document and an external resource.

Local Attributes of the link Element:

AttributeDescription
hrefthe URL of the resource.
hreflangthe language of the linked resource.
mediathe device that the linked content is intended for.
relthe relationship between the document and the linked resource.
sizesSpecifies the size of icons.
typethe MIME type of the linked resource, such as text/css or image/x-icon.

The following table list some selected values for the rel attribute of the link element:

ValueDescription
alternateLinks to an alternative version of the document
authorLinks to the author of the document.
helpLinks to help related to the current document.
iconan icon resource.
licenseLinks to a license associated with the current document.
pingbacka pingback server
prefetchprefetches a resource.
sylesheetLoads an external CSS stylesheet.

Loading a Stylesheet Using the link Element

 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
      <a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
  

You can use multiple link elements to load multiple external resources.

Home 
  HTML CSS Book 
    HTML  

Document Structure:
  1. The doctype Element
  2. The html Element
  3. The head Element
  4. The body Element
  5. Setting the Document Title
  6. Setting the Base for Relative URLs
  7. Specifying Name/Value Metadata Pairs
  8. Declaring a Character Encoding
  9. Simulate an HTTP Header
  10. Defining CSS Styles
  11. Specifying the Media for a Style
  12. Denoting External Resources
  13. Defining a Favicon for Your Page
  14. Using the Scripting Elements
  15. Loading an External Scripting Library
  16. Deferring Execution of a Script
  17. Executing a Script Asynchronously
  18. The noscript Element
  19. Redirect the user to a different URL if it doesn't support JavaScript.
Related: