Or i should render as default(IE8)?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
My purpose is to make site compatible with IE8 also.
Or i should render as default(IE8)?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
My purpose is to make site compatible with IE8 also.
Yes there are cons. IE7 is bad. You don't want IE8 to pretend being bad, just so you can get away with poor design decision...
Well, that depends on whether you need it! If your site is broken in IE8 (e.g. because you use conditional comments or hacks to identify IE that apply to 8 as well) and it's not an option to fix it, use the compatibility mode. Otherwise, don't - if you're lucky, your HTML might render identically in IE8 and the current Gecko / Webkit browsers.
EmulateIE7
is a fix to ensure compatibility without webmasters having to painfully re-build their pages straight away.
It's definitely not a good practice to use if you're building a site from scratch.
IE7 compatibility does not work like IE7 despite anything Microsoft says.
[comment to Pekka's answer that won't fit in a comment:]
What will happen when on old site any user will revert rendering back to IE8 using button near address bar.
If you specify IE=EmulateIE7
, there will be no ‘compatibility mode’ button present for the user to click. Putting any IE=
option in sets that mode as definitive.
So if you want to work on IE8 as IE8 but you don't want the broken-looking button to appear, you say:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
(Make sure the page works in IE8 mode first!)
You can also say IE=Edge
, which will always give you the latest mode (so on IE9, the browser will not pretend to be IE8). You'll have to be confident that your code is all nicely standards-compliant before doing that. You should be OK if the page works in the other browsers (firefox, chrome, opera...).