HTML elementHTML
The objective of this technique is to identify the default language of a document by providing the lang attribute on the html element.
Identifying the language of the document is important for a number of reasons:
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>document écrit en français</title>
</head>
<body>
... document écrit en français ...
</body>
</html>
Examine the html element of the document.
html element has a lang attribute.lang attribute conforms to BCP 47: Tags for Identifying Languages; Matching of Language Tags or its successor and reflects the primary language used by the Web page.