Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we put two meta tags in HTML?

Tags:

html

meta

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.

like image 467
Coolguy Avatar asked May 06 '13 09:05

Coolguy


1 Answers

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.

like image 96
Golo Roden Avatar answered Oct 30 '22 23:10

Golo Roden