Language
If you use a different language within the body of your page such as Spanish, French, Italian, German, Chinese, etc. then the language attribute (lang
) would need to be used for that text. This will ensure the screen reader pronounces the word or phrase correctly with the proper accent.
lang="es"
(Spanish)lang="fr"
(French)lang="it"
(Italian)lang="de"
(German)lang="zh"
(Chinese)
Code Examples
Add the lang attribute to an entire paragraph in Spanish:
<p lang=鈥渆s鈥>La bicicleta es roja.</p>
Add the lang attribute to an image with Spanish alt text:
<img src=鈥渋mage.jpg鈥 alt=鈥渦na bicicleta roja鈥 lang=鈥渆s鈥 />
Add the lang attribute to text in the middle of a paragraph:
<p>The title is <span lang=鈥渇r鈥>Le Bon Usage</span>.</p>