typestar

Language and direction in HTML

Getting the language right changes pronunciation, hyphenation and quotation marks.

<p>The French call it <span lang="fr">bricolage</span>.</p>

<blockquote lang="de">
  <p>Ordnung ist das halbe Leben.</p>
</blockquote>

<p dir="rtl" lang="he">&#1513;&#1500;&#1493;&#1501;</p>

<ul>
  <li>User <bdi>ada</bdi>: 71 wpm</li>
  <li>User <bdi>grace</bdi>: 68 wpm</li>
</ul>

How it works

  1. lang on an element overrides the document's language for its subtree.
  2. dir="rtl" switches the base direction for right-to-left scripts.
  3. <bdi> isolates a name whose direction you do not control.
  4. Numeric references write any script from an ASCII keyboard.

The run, in numbers

Lines
12
Characters to type
278
Tokens
96
Three-star pace
70 tpm

At the three-star pace of 70 tokens a minute, this run takes about 82 seconds.

Type this snippet

Step 4 of 4 in Start with the right element, step 4 of 15 in Accessible HTML.

← Previous Next →