HTML and CSS Reference
In-Depth Information
Introduce lang Attributes
Add lang and xml:lang attributes to each root element identifying the primary language of the document. Add
superseding lang and xml:lang attributes to any element in that document that is written in a different
<html xmlns="">
<p>Pierre shouted, "Vive la France!"</p>
<html xmlns=""
lang="en-US" xml:lang="en-US">
<p>Pierre shouted,
"<span lang="fr" xml:lang="en-US">Vive la France!</span>"
Proper language identification is important for pronunciation by screen readers.
Language identification also assists search engines. Your French pages are more likely to be picked up by and your German pages by if the content is properly tagged.
Finally, language identification assists you when authoring pages, especially when working in something other
than a system's primary language. It enables editors to choose the proper dictionary for spell checking.
Potential Trade-offs
None. This is only for the good.
If you know none of your documents already contains a lang or xml:lang attribute, and that they're all written
in the same language, it's easy to search for <html and replace it with <html lang='en' xml:lang='en' .
If you aren't certain whether there are any such attributes already, try searching for lang\s*=\s*['"a-zA-z] .
If nothing turns up, it's highly likely that there aren't any.
If you do find that some of your documents have such attributes already and some don't, the following regular
Search WWH ::

Custom Search