radbyx radbyx - 5 months ago 30
HTML Question

One or multiple meta-tags?

I just realized I have two

meta
tags in my HTML
head
:

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">


Do both work when there are multiple? Should I merge them? Is it just as good with having multiple meta-tags?

Answer

Have a look at the definition of the meta element. It says:

Exactly one of the name, http-equiv, and charset, attributes must be specified.

So your two example meta elements couldn’t possibly be merged, because then the meta element would have the charset and the name attribute, which is not allowed.