10. What is the purpose of the lang attribute?

The lang attribute identifies the language of the element's content. Setting it on the root <html> element helps browsers, search engines, translation tools, and assistive technologies interpret the document correctly.

Key Takeaways
  • Declare the document's language.
  • Language metadata supports accessibility and user agents.
Knowledge Check

Where is the primary document language commonly declared?