Table of contentsBypass table of contents
The HTML link element is very similar to the HTML a element because it's used to link a document to other resources. But unlike it, the HTML link element can only be defined in the head section of the document (HTML head element) and is used to provide global relational information about the document.
For example, authors can link to a document that acts as index for the current document, to an alternate version in other language, or an alternate version designed for other media (e.g., a printer).
A particular and very common use for the HTML link tag is to provide an external style sheets file for the document. To find extra information about this practice, visit our "Cascading Style Sheets" tutorial.
In the next example, the following relational information about the current document is provided: an index, the previous document in the sequence, the next socument in the sequence, an alternate version for printer, an alternate version in spanish and a file containg style sheets information.
The "id" attribute assigns an identifier to the associated element. This identifier must be unique in the document and can be used to refer to that element in other instances (e.g., from client-side scripts).
The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It's used together with style sheets and tells the browser the class (or classes) to which the element is associated with.
A class gives presentational attributes to elements (read more at the Cascading Style Sheets tutorial).
This attribute is used to define presentational attributes for the containing element, and its value should be composed by style sheets properties. Although, in some cases, it can become useful, a better practice is to place presentational attributes in external files, relating them to elements with the "class" attribute. This way you keep the semantic and presentational parts of your document separated.
You can find more information about presentational attributes at the Cascading Style Sheets tutorial.
The purpose of this attribute is to provide a title for the element. Its value must be a short and accurate description of the element. Browsers usually render it as a "tool tip" when the user put the mouse pointer over the element for a small period of time.
Specifies the language of an element's content. The default value in "unknown".
When writing XHTML 1.0 documents, the attribute used to specify the language of an elements is "xml:lang". For forward and backward compatibility both attributes can be used simultaneously like in the example below. Note, that in XHTML 1.1 the "lang" attribute has been completely replaced by "xml:lang" and its use is no longer valid.
This attribute indicates the direction in which the texts of the element must be read. This includes content, attribute values and tables. It has two possible values that are case-insensitive:
Specifies the character encoding of the destination document. For more information on how to fill this attribute, refer to the character encodings reference.
The "href" attribute specifies the destination resource, which the element is linking to. It may specify a resource in the same website or in an external one.
States the language the destination document is written in. This attribute may only be used when the "href" attribute is present in the element.
This attribute Provides information about the content type of the destination resource, telling wether it's an HTML document, a JPG image, an Excel document, etc. Its value should be one of the MIME types.
Describes the relationship that keeps the current document with the destination resource. In other words (more specific) states the meaning of the referred resource for the actual document.
Establishes a relationship between the destination resource and the current document. In other words (more specific), states what the actual document represents for the referred resource.
Specifies the name of the frame where the destination document should be loaded. Refer to the frame-target type definition for further information.
Specifies the media for which the destination resource has been designed. It can be a single media or a comma-separated list of medias. The default value is "screen".
See a complete list and information about events in HTML
Diseño y desarrollo: Latitud29.com