← All tutorials

GoCareerGo Tutorials

HTML Tutorial

Tags, attributes, HTML5 APIs and semantic markup — the web's foundation.

lang and dir Attributes

lang declares the document's language for screen readers/translators; dir declares text direction.

<html lang="en" dir="ltr">
<html lang="ar" dir="rtl">
  • lang helps screen readers pick the right pronunciation and browsers offer translation
  • dir="rtl" is essential for Arabic, Hebrew and other right-to-left languages