HTML link tag and element
1. HTML link element defines relationship between two HTML documents.
2. It can be used only within head tags of an HTML document.
3. link element starts with <link> tag and it's end tag is forbidden.
Syntax
<link rel='value' href='link' type='type of content the linked document is containing' />
Whether both start and end tags are required
The start tag is required but end tag is forbidden.
Can contain
HTML link element is an empty element, i.e. it can not contain any other text or element.
Can reside within
HTML link element can reside within head element.
Attributes
Identifiers
language information and text direction
Title
Style
Events
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.
Image maps
Target frame information
Tabbing navigation
Access keys
Links and anchors
href, hreflang, type, rel, rev.
Header style information
character encodings
Example of using HTML link element
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML link tag example > HTML tutorial | w3resource</title>
<link rel="stylesheet" type="text/css" href="link.css">
</head>
<body>
<ul>
<li>PHP Tutorial</li>
<li>JavaScript Tutorial</li>
<li>MySQL Tutorial</li>
</ul>
</body>
</html>
Result
View this example in a separate browser window
Previous: HTML a tag and element
Next:
HTML base tag and element
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/link/HTML-link-tag-and-element.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics