The Root of an HTML Document
Published on .
What is it?
<html>
element is the root element of the HTML page. It is the absolute parent element of the <head>
and <body>
elements.
Do you need to include it?
Yes, you must include it with the lang
attribute—<html lang="en">
.
You must add a lang
attribute to tell web browsers and translation API the language of your website. Also, to have your website compliant with 3.1.1 Language of Page criterion from Web Content Accessibility Guidelines (WCAG) version 2.1.
For example, you must use lang="en"
if your website is written in English. Another example is you must use lang="es"
if your website is written in Spanish.
Resources
<html>
: The HTML Document / Root element - HTML: HyperText Markup Language | MDN
A list of values for the lang
attribute — List of ISO 639-1 codes - Wikipedia
HTML Language Codes - Dofactory
Understanding Success Criterion 3.1.1: Language of Page | WAI | W3C
lang - HTML: HyperText Markup Language | MDN