w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



title lang attribute

The lang attribute on the title element:

Recommendation: specify the language of the document on the html root element; it is considered good practice.

Examples

<titleattribute="value(s)">...<⁄title>example
16.lang=language code<title lang="en"> ... <⁄title>
<title lang="fr"> ... <⁄title>

Video demonstration title lang attribute

HTML5 title lang attribute Tutorial

min video details
00:06 launching lang.php file in browser
00:09 page's content is in French
00:20 opening lang.php file in Notepad++
00:23 the html root element has the value of the lang attribute:"fr", which corresponds with the page content's language
00:30 but the page title is in English
00:23 because the page's content is in French we can add the lang attribute on the html root element, with the value "fr"
00:27 page's title is in English
00:42 because the page's title is in English we can add the lang attribute on title element, with the value "en"

note: althought page's language is set to French, by adding the lang attribute on the html root element, this value won't be applied on title element because on an element level, title, we specified a new language, this last one applies
title intro title required title occurrences title browser display title parents - children title ELEMENT vs title ATTRIBUTE title syntax