<meta charset=“utf-8”> vs <meta http-equi

2018-12-31 04:40发布

In order to define charset for HTML5 Doctype, which notation should I use?

  1. Short:

    <meta charset="utf-8" /> 
    
  2. Long:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

7条回答
君临天下
2楼-- · 2018-12-31 05:04

<meta charset="utf-8"> was introduced with/for HTML5.

As mentioned in the documentation, both are valid. However, <meta charset="utf-8"> is only for HTML5 (and easier to type/remember).

In due time, the old style is bound to become deprecated in the near future. I'd stick to the new <meta charset="utf-8">.

There's only one way, but up. In tech's case, that's phasing out the old (really, REALLY fast)

Documentation: HTML meta charset Attribute—W3Schools

查看更多
登录 后发表回答