What if you need to include text from other languages? Greek? French (with its accents)? Or even Chinese? The first thing you must do is to define the base language for your page. You can do this in the HTML element itself. Your HTML element would look like this:

<HTML lang=”EN”>

The value of the lang attribute should be a valid two-character language code. If you then have a paragraph with a different language as the base—say Spanish— then you could identify the base language for that paragraph by putting a lang attribute into the P element like this:

<P lang=”SP”>


Sometimes you simply want to include a sentence or a word in another language.

The SPAN element is most appropriate for those times.

You probably noticed that most of the block-level elements include both lang and dir attributes. These often need to work together. Some languages are actually read right to left. HTML accommodates the creation of pages using these languages by rendering in the direction you dictate. You still create the text in a left-to-right direction, but it is rendered right-to-left, if you indicate, thus

<BODY lang=”CH” dir=”rtl”>
would give you a body with a base language of Chinese and a text direction of right to left. This is the bidirectional algorithm override element. It enables you to override the base direction. The dir attribute is mandatory for the BDO element.

Bidirectional Algorithm Override <BDO>

Start Tag: Required
Content: Inline elements
End Tag: Required

Attributes:
dir: Mandatory: ltr or rtl
id, class: used in conjunction with style sheets
lang: language
style: for style sheets
title: gives the element a title