Can we put two meta tags in HTML?

Coolguy picture Coolguy · May 6, 2013 · Viewed 15.5k times · Source

Can I put two meta tags in a web page?

I want to put:

 <meta http-equiv="Pragma" content="no-cache" />

so that my web page will not be cached

and:

 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

so that my web page is IE-compatible.

Answer

Golo Roden picture Golo Roden · May 6, 2013

Yes, this is definitely possible and valid (and actually most of the times even necessary). Basically, you can have an arbitrary number of them, as long as you put all of them into the head section of your website. Additionally you should watch out not to have multiple meta elements for the same concern.

Please note that for full XHTML compliance your second meta is missing the closing /. It should be:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

So your final code might be:

<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

Please note as well, that the order of the meta elements is not completely arbitrary, or at least there are some elements where you should pay attention to the order.

E.g., the meta element that defines the encoding should be as far at the beginning as possible, since the browser will start re-rendering the website as soon as it approaches this element.