Modern HTML lang Attribute for Chinese Websites

Chinese is pretty complicated, same applies to <html lang="__WTF?__"> attribute.

Fortunately, I've already summarized it up:

  1. zh-CN/zh-TW/zh-HK/zh-SG still works fine, even if there are opposite opinions;
  2. zh-cmn-Hans-CN works best for contents localized for China Mainland users:
    • zh for backward compatibility since it's been widely adopted by mainstream websites and crawlers, etc;
    • cmn denotes Chinese Mandarin, the official speech of Chinese;
    • Hans denotes that the contents are in Simplified Chinese form;
    • CN denotes the contents were specifically adapted for China Mainland.
  3. zh-Hant works great for contents written in Traditional Chinese;
  4. When in doubt, use bare zh.

Example

<!DOCTYPE html>
<html lang="zh-cmn-Hans-CN">  <meta charset="UTF-8"/>
  <title>你好,世界!</title>
  ...