html5 Site Icon CSS3 Site Icon CSS Site Icon

HTML4 Reference

HTML <link /> tag

Definition

The <link /> tag is a self closing tag that allows us to link to an external resource such as an image or stylesheet from within a HTML file.

The <link /> tag must reside within the <head></head> element.

Example


<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>A Title which will appear in the Windows title bar.</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

  <link href="../global.css" rel="stylesheet" type="text/css" />

</head>
<body>
</body>
</html>

Required Attributes

NONE

Optional Attributes

rev - no browser support - specifies the relationship of the linked document to the current page.

target - limited browser support - specifies where to open the target.

charset specifies the character set of the linked document.


<link href="http://htmldoctor.info/images/chickenpiesmall.jpg"
   charset="ISO-8859-1" /> 

href specifies the target URL to link to.


<link href="http://htmldoctor.info/images/chickenpiesmall.jpg" />

hreflang specifies the language of target URL to link to.


<link href="http://htmldoctor.info/images/chickenpiesmall.jpg"
   hreflang="en" /> 

media specifies a media with which the link is associated with.


<!-- media values supported in all browsers are (all, print, and screen) -->]

<!-- Other possible values are (aural, braille, handheld, projection tty and tv) -->
<link href="http://htmldoctor.info/images/chickenpiesmall.jpg"
   media="print" /> 

rel specifies the relationship of the linked document to the current page.


<!-- The only rel type supported in all browsers is the stylesheet relationship -->

<!-- Other possible values which do not have universal browser support are: -->

<!-- (alternate, appendix, bookmark, chapter, contents, copyright, help,  -->
<!--  glossary, index, next, prev, section, start and subsection) -->

<link href="http://htmldoctor.info/images/chickenpiesmall.jpg"
   rel="stylesheet" /> 

type specifies the MIME type of the linked document.



<link href="http://htmldoctor.info/images/chickenpiesmall.jpg"
   type="text/css" /> 

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<link class="classname" />

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<link id="idname" />

style - specifies an inline style for the element allowing you to apply the style to the content.


<link style="color:red;text-align:left" />

title - specifies extra information about the content.


<link title="information about the content" />

Language Attributes

dir - specifies the directional flow of the content.


<link dir="ltr" />   <!-- The text will flow from left to right -->
<link dir="rtl" />   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<link lang="en" />

xml:lang - specifies a language code for the content of the element in XHTML documents.


<link xml:lang="fr" />

Event Attributes

NONE

Although the <link /> tag supports mouse and key events the <link /> tag is situated within the <head></head> element. This element isn't visible within a HTML document so although these events are allowed they seem to serve no purpose within the <link /> tag.



<li> tag    << Prev          Next >>  <map> tag

go to home page Homepage go to top of page Top

HTML Elements

The complete set of HTML elements also known as HTML tags from the latest HTML 4.01 Specification.

Click the links for more information on individual tags and their attributes.

<!--...-->

<!DOCTYPE>

<a>

<abbr>

<acronym>

<address>

<applet>

<area />

<b>

<base />

<basefont />

<bdo>

<big>

<blockquote>

<body>

<br />

<button>

<caption>

<center>

<cite>

<code>

<col />

<colgroup>

<dd>

<del>

<dfn>

<dir>

<div>

<dl>

<dt>

<em>

<fieldset>

<font>

<form>

<frame />

<frameset>

<h1> - <h6>

<head>

<hr />

<html>

<i>

<iframe>

<img />

<input />

<ins>

<isindex />

<kbd>

<label>

<legend>

<li>

<link />

<map>

<menu>

<meta />

<noframes>

<noscript>

<object>

<ol>

<optgroup>

<option>

<p>

<param />

<pre>

<q>

<s>

<samp>

<script>

<select>

<small>

<span>

<strike>

<strong>

<style>

<sub>

<sup>

<table>

<tbody>

<td>

<textarea>

<tfoot>

<th>

<thead>

<title>

<tr>

<tt>

<u>

<ul>

<var>