<meta charset="utf-8"> 与 <meta http-equiv="Content-Type">

问题描述

在 HTML5 中,它们是等价的。使用较短的,因为它更容易记住和输入。浏览器支持很好,因为它是为向后兼容而设计的。

解决方法

为了定义HTML5 Doctype的字符集,我应该使用哪种表示法?

  1. Short:

html <meta charset="utf-8" />

  1. Long:

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