html5 - html的lang属性设置zh-CN好还是en好呢?有什么作用?
伊谢尔伦
伊谢尔伦 2017-04-17 13:21:11
0
3
906

html的lang属性设置zh-CN好还是en好呢?有什么作用?现在用的webstorm编辑器,默认就是设置的en

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
大家讲道理

The lang attribute of HTML can be used to mark the language of a web page or part of a web page. In other words, the lang attribute can not only be used on html tags

    <html lang="en">

can also be used on other tags:

<p>You'd say that in Chinese as <span lang="zh-Hans">中国科学院文献情报中心</span>.</p>

It means the language of the natural language within the tag. Or declare the main natural language language used by the entire web page.
For the value code manual of lang, please refer to:

http://www.w3schools.com/tags/ref_language_codes.asp

What does it do?

To put it simply, it may not have much effect on the program, but it can tell browsers, search engines, and some programs that process Html to do some corresponding processing or things on the language content of the page.
For example, you can

  • Set css styles or fonts in different languages ​​according to the lang attribute

  • Tell search engines to do precise identification

  • Let the grammar checker do the language recognition

  • Help translation tools do recognition

  • Help the web page reading program to identify
    etc.

For more information, please refer to:

https://www.w3.org/International/questions/qa-lang-why

小葫芦

There are no "huge" benefits that you can think of, but referring to the explanation given in w3school below may help you understand.

When the search engine or browser gets the language tag, it is possible to perform some auxiliary operations for the specified language

伊谢尔伦

The default setting is en, then the Chrome browser will ask you if you want to translate into other languages~~~:)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!