<元字符集=“utf-8">vs<meta http-equiv=“Content-Type">

2022-01-30 00:00:00 html meta-tags doctype

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" />
    

解决方案

In HTML5, they are equivalent. Use the shorter one, as it is easier to remember and type. Browser support is fine since it was designed for backwards compatibility.

相关文章