link href attribute
The href attribute on the link element:
- allows you to add the path (a valid url) of the resource to be linked to your HTML5 document
- can create: a hyperlink or an external resource link »video
- href is a specific attribute → can be applied ONLY on the next HTML5 elements: a, area, base, link
Warning:
- is required, otherwise the link element does not create a link (does not link a resource to another)
- 1 href attribute allowed per 1 element
Examples
<link | attribute | = | "value(s)" | > | Examples | ||
---|---|---|---|---|---|---|---|
1. | href | = | URL | <rel="next" href="page2.php"> |
Video demonstration link href attribute
HTML5 link href attribute Tutorial
min | video details |
---|---|
00:09 | this video tutorial presents the href attribute on a link element |
00:22 | adding the <link> element to our document |
00:27 | adding the href attribute to link element |
00:36 | let's select a resource and link it to our html document: e.g. the main.css file |
00:41 | adding the resource's path as value of the href attribute, thus linking the resource to our page |
00:48 | a second example: linking another resource: e.g. the favicon.png |
01:01 | changing the url to point toward the new resource, the favicon |
01:06 | Note: the 2 resources were linked to our page but they don't display ⁄apply because their relationship (rel attribute » video ) with the current page has not been specified |
01:15 | rel attribute in this case is required |
01:20 | adding rel attribute to page, for example purpose; we've added the empty string "" value for simplicity because this video tutorial is not about rel attribute, BUT please note, the empty string is not a valid value for rel attribute; it must be one of the keywords defined by specs |