HTML lang attribute
- type
- attribute, on <html>
- applies to
- the whole page
- lives inside
- the opening <html> tag
- common values
- en, en-US, es, fr, ja
Where it goes
On the opening <html> tag, so it covers the whole page. A single tag can have its own lang if part of the page is in another language.
Example
<html lang="en">
...
</html>Open this example in the editor →
Common mistakes
- Leaving it off. The page looks exactly the same without it, so it is easy to forget. The difference only shows up in tools that read it.
- Writing the language name instead of its code. It is lang="en", not lang="English".