Attributes: lang

The language of the document can be declared in the <html> tag, with the lang attribute.


HTML file:

<!DOCTYPE html>
<html lang="en-US">

<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>


The first two letters specify the language (en). If there is a dialect, use two more letters (US).

Good habit Declaring a language is important for accessibility applications (screen readers) and search engines.
Back button Table of Contents Next button