XHTML » XHTML Core Tag » lang

Syntax:
lang="languagecode"

The lang attribute is used to define the base language to be used for displaying text and characters on a Web site. This allows an internationalization of HTML for a very large number of languages.

The languages are designated by a two letter code, such as "en" for English or "el" for Greek. One or more hypenated values can be tacked on to the initial two letter code to specify regional or ethentic variations, such as "en-us" for U.S. English.
 
Note that .html texts that contain foreign languages that use special characters will have to be saved as a Unicode file, rather than as an ANSI file, in order for the characters to be properly displayed. Please be aware that some browsers may not be capable of correctly displaying a Unicode file.
 

Examples

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>DevGuru XHTML lang Attribute Example</title>
</head>
<body>
<span lang="el">
... place text of foreign language here ...
</span>
</body>
</html>
Language(s): XHTML

See Also: