a hreflang attribute
The hreflang attribute on the a element:
- allows you to add the language of the linked resource; this information is purely advisory
- hreflang is a specific attribute → can be applied ONLY on the next HTML5 elements: a, area, link
Warning: hreflang attribute can be used only if href attribute is present on a element.
Examples
<a | attribute | = | "value(s)" | > | ... | <⁄a> | example |
---|---|---|---|---|---|---|---|
3. | hreflang | = | language code | <href="file.php" hreflang="en"> ... <⁄ > |
Video demonstration a hreflang attribute
HTML5 a hreflang attribute Tutorial
min | video details |
---|---|
00:08 | video tutorial: a element, hreflang attribute objective: understanding hreflang attribute |
00:16 | the hreflang attribute: - is optional - can be used only if href attribute is present - allows you to specify the language (code) of the linked resource |
00:23 | the href attribute is present on a element → we can add the hreflang attribute too |
00:29 | the language of the content_editable.php (the linked resource) is English ; the corresponding language code is: en |
00:36 | note: the content of the page is in English language |
00:44 | adding the language of the linked resource to the a element through hreflang attribute |
00:53 | if your linked resource is in other language, search for its corresponding code and add it as value of the hreflang attribute |