is it ok to include two meta tags in the <head> tag?
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<meta http-equiv=“X-UA-Compatible” content=“IE=edge” />
the first meta tag is from Ian Loyds ‘BYOWTRW’, the second meta tag is from a different book. I was wondering if 2 meta tags like that are accpetable?
I disagree, you can use it to force IE to use standards mode even when quirks would have traditionally been triggered, thereby you can enforce strict compliance rather than transitional. Yes being able to flip compatibility is one method, but being able to dictate standards mode can be beneficial.
I never said it couldn’t be. What I said was that if you have more than 12 meta tags in the page then there are probably some that are unnecessary unless you have scripts on the site that actually use them. Having one or two that are just descriptive is reasonable.
I disagree felgall, sometimes META information can be descriptive beyond scripting. I know plenty of social networks which are using Metadata to better describe a websites contents. That being said I tend to group much of my META data into an RDF file marked up using the DCMI specification (my header has a lot more LINK elements than anything else). As for the original poster… you should NEVER use “IE=edge” as the value for the IE compatibility filter… what that value means is the level of standards compliance will depend on the version of the browser used, unless you plan on upgrading your website for every new version of Internet Explorer you shouldn’t trigger that explicit setting (else you could find it works in one version and not another). For a beginner using that META tag is quite frankly unnecessary and I’m surprised you added it in - general rule of thumb, unless you need something, don’t add it into the code.
You only need “X-UA-Compatible” when you want IE 8 to render using IE 7 compatibility mode. Other wise if you follow standard based development you will never need.
Yes - view the html source files of some popular sites such as:
Technically you can have several as long as they don’t conflict and not all of them will be understood by all User Agents.
Albeit if you haven’t declared your (x)html ‘character encoding’ at a “higher level” really the; <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /> should go above the <title> not below it because by then it comes in the document too late.
No problem, glad you found the replies useful to further your understanding about meta data.
having more than 1 metatag is quite common place in website design. Most websites also use Metatags for SEO purposes. (Keywords and description)
Having more than a dozen meta tags in the head would be going a bit far unless you actually have scripting in place on the site that uses them all.