Learn html - html tutorial - Lang attribute in html - html examples - html programs
The lang attribute is used to declared the language of the document/content .
The lang attribute will guide the search engine and browsers to understand the basic language for the website.
Based on the ISO standard each language will have unique code to declare in lang attribute.
The lang attribute is a global attribute .
Example: English – en , Chinese – zn , Spanish - es
Syntax for lang attribute in HTML:
<element lang =”language_code”>
Difference between HTML 4.01 and HTML 5 for lang Attribute:
HTML 4.01
HTML 5
HTML 5, support the lang attribute.
Applies To:
Element
Attribute
All HTML element
lang
lang Attribute Values:
Value
Description
lang
lang attribute is used to specify the language code for an element’s contents.
Sample Coding for lang Attribute in HTML:
Tryit<!DOCTYPE html>
<html >
<head>
<title> Wikitechy lang attribute</title>
</head>
<body>
<h2> This is a HTML lang attribute example</h2>
<h3 lang="es"> Bienvenido a Wikitechy!</h3>
</body>
</html>
Code Explanation for lang Attribute in HTML:
lang attribute declared within the <h3> tag to define the language as “es” (spanish).
Output for lang Attribute in HTML:
The output shows the Spanish content. But the lang attribute value not visible to user that will be used to search engine for regional search results.
Browser Support for lang Attribute in HTML:
ISO Language Code:
Based on the w3c recommendations we should declare base or primary language for website and it should reflect in all the web pages.
Languages and ISO codes list
ISO Code
Name
ab
Abkhazian
Aa
Afar
Af
Afrikaans
Sq
Albanian
Am
Amharic
ar
Arabic
an
Aragonese
hy
Armenian
as
Assamese
ay
Aymara
az
Azerbaijani
ba
Bashkir
eu
Basque
bn
Bengali(Bangla)
dz
Bhutani
bh
Bihari
bi
Bislama
Br
Breton
Bg
Bulgarian
my
Burmese
be
Byelorussian (Belarusian)
km
Cambodian
ca
Catalan
zh
Chinese
zh-Hans
Chinese (Simplified)
zh-Hant
Chinese (Traditional)
co
Corsican
hr
Croatian
cs
Czech
da
Danish
nl
Dutch
en
English
eo
Esperanto
et
Estonian
fo
Faeroese
fa
Farsi
fj
Fiji
fi
Finnish
fr
French
Fy
Frisian
Gv
Gaelic (Manx)
Gd
Gaelic (Scottish)
gl
Galician
ka
Georgian
de
German
el
Greek
kl
Greenlandic
gu
Gujarati
gn
Gujarati
ht
Haitian Creole
ha
Hausa
he,iw
Hebrew
hi
Hindi
hu
Hungarian
is
Icelandic
io
Ido
Id,in
Indonesian
ia
Interlingua
ie
Interlingue
iu
Inuktitut
ik
Inupiak
ga
Irish
it
Italian
ja
Japanese
jv
Javanese
kn
Kannada
ks
Kashmiri
kk
Kazakh
rw
Kinyarwanda(Ruanda)
ky
Kirghiz
rn
Kirundi(Rundi)
ku
Kurdish
lo
Laothian
la
Latin
lv
Latvian(Lettish)
li
Limburgish(Limburger)
ln
Lingala
lt
Lithuanian
mk
Macedonian
mg
Malagasy
ms
Malay
ml
Malayalam
mt
Maltese
mi
Maori
mr
Marathi
mo
Moldavian
mn
Mongolian
na
Nauru
ne
Nepali
no
Norwegian
oc
Occitan
or
Oriya
om
Oromo (Afaan Oromo)
ps
Pashto (Pushto)
pl
Polish
pt
Portuguese
pa
punjabi
qu
Quechua
rm
Rhaeto-Romance
ro
Romainan
ru
Russian
sm
Samoan
sg
Sangro
sa
Sanskrit
sr
Serbian
sh
Serbo-Croatian
tn
Setswana
sn
Shona
ii
Sichuan Yi
sd
Sindhi
si
sinhalese
ss
Siswati
sk
Slovak
sl
Slovenian
so
Somali
es
Spanish
su
Sundanese
sw
Swahili(Kiswahili)
sv
Swedish
tl
Tagalog
tg
Tajik
ta
Tamil
tt
Tatar
te
Telugu
th
Thai
bo
Tibetan
ti
Tigrinya
to
Tonga
ts
Tsonga
tr
Turkish
tk
Turkmen
tw
Twi
ug
Uighur
uk
Ukrainian
uz
Uzbek
ur
Uzbek
vi
Vietnamese
vo
Volapük
wa
Wallon
cy
Welsh
wo
Wolof
xh
Xhosa
yi,ji
Yiddish
yo
Yoruba
zu
Zulu
Related Searches to lang Attribute in html
html5 lang attribute
html lang en-au
html lang multiple languages
four attributes of language
html lang attribute seo
attributes of human language
html lang attribute english
html lang attribute multiple languages
html attributes
html tutorials html editor html code html form html tutorial html color html color codes html table html img html5 html code for website html and css html programs html website free html editor html5 tutorial wysiwyg html editor html tutorial pdf html converter php tutorial html example html tutorial css tutorial html css html tags html basics code html html online html mailto html lang html tags list