我刚刚意识到我的 HTML head
中有两个 meta
标签:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
当有多个时两者都有效吗?我应该合并它们吗?拥有多个元标记是否同样好?
最佳答案
看看 definition of the meta
element .它说:
Exactly one of the
name
,http-equiv
, andcharset
, attributes must be specified.
因此您的两个示例 meta
元素不可能合并,因为这样 meta
元素将具有 charset
和 name
属性,这是不允许的。
关于html - 一个或多个元标记?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34560130/