This article mainly introduces the role of lang in html tags. Interested friends can refer to it. I hope it will be helpful to everyone.
The lang attribute written in the html tag functions: declares the language type of the current page.
For example:
<html lang='en'></html> //英文
<html lang='zh'></html> //中文
<html lang='ja'></html> //日文
<html lang='en-us'></html> //美式英文
Note: The language code in the lang attribute is not case-sensitive
<html lang='en-us'></html> //英文
<html lang='en-US'></html> //英文
The above two lines of code have the same effect.
In addition, the lang attribute can also be added to ordinary tags.
For example:
<p lang='en'>this is English .</p>
lang attribute--HTML language declaration attribute
<html xmlns="//m.sbmmt.com" lang="en" xml:lang="en"> <html xmlns="//m.sbmmt.com" lang="zh-CN" xml:lang="zh-CN">
en
Definition language is English
zh-CN
Definition language is Chinese
If the web page is defined as XHTML1.1 or XML format, you can use the xml:lang attribute (because the xml:lang attribute is the standard usage to determine language information in XML).
If the web page uses HTML format, you should use both xml:lang and lang attributes.
##Definition and usage