Home / Learn HTML / HTML Languages and Directions

HTML Languages and Directions

Build pages for Hindi, Arabic, Japanese and more. Language and direction attributes do the work.

In shortSet lang on the page, dir="rtl" for right to left scripts, and use UTF-8.

Definition

Internationalization prepares a page for many languages and writing directions. Use the lang attribute, UTF-8, the dir attribute for right to left languages and hreflang links to connect the translated versions.

Theory in plain words

Directiondir="ltr"English, HindiLeft to rightdir="rtl"Arabic, HebrewRight to left
Direction

What it is

Internationalisation makes a page work for many languages and writing directions.

Why we use it

It lets Hindi, Arabic or Japanese readers use your page correctly.

How it works

The lang attribute names the language, dir sets left to right or right to left, and UTF-8 stores every letter.

Where it is used

  • Multi language sites
  • Arabic and Hebrew pages (rtl)
  • Translation tools and screen readers
Page languageTry it Yourself
Mixed languagesTry it Yourself
Right to left pageTry it Yourself

Even the list bullets move to the right side.

bdi for unknown textTry it Yourself
bdo to force directionTry it Yourself
Do not translateTry it Yourself
Language specific quotesTry it Yourself
Language links (hreflang)Try it Yourself
Unicode and numbersTry it Yourself
Language pickerTry it Yourself

Quick quiz

1. Which attribute sets the language?

2. Right to left text uses

3. Charset for all languages

My notes
Ask a question about this lesson