Denoting External Resources
The link element links an HTML document and an external resource.
Local Attributes of the link Element:
Attribute | Description |
---|---|
href | the URL of the resource. |
hreflang | the language of the linked resource. |
media | the device that the linked content is intended for. |
rel | the relationship between the document and the linked resource. |
sizes | Specifies the size of icons. |
type | the 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:
Value | Description |
---|---|
alternate | Links to an alternative version of the document |
author | Links to the author of the document. |
help | Links to help related to the current document. |
icon | an icon resource. |
license | Links to a license associated with the current document. |
pingback | a pingback server |
prefetch | prefetches a resource. |
sylesheet | Loads 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
HTML CSS Book
HTML
Document Structure:
- The doctype Element
- The html Element
- The head Element
- The body Element
- Setting the Document Title
- Setting the Base for Relative URLs
- Specifying Name/Value Metadata Pairs
- Declaring a Character Encoding
- Simulate an HTTP Header
- Defining CSS Styles
- Specifying the Media for a Style
- Denoting External Resources
- Defining a Favicon for Your Page
- Using the Scripting Elements
- Loading an External Scripting Library
- Deferring Execution of a Script
- Executing a Script Asynchronously
- The noscript Element
- Redirect the user to a different URL if it doesn't support JavaScript.
Related: