0

I am coding a site in IE 9. The layout looks perfect in IE 9 and IE 8 as well as IE 6 BUT it's completely messed up in IE 7. Also, the issue is when I press the compatibility button in IE 9 - the layout is messed up beyond comprehension..My question is - how can you make the layout ok when one presses compatibilty button in IE 9. Thank you , regards !

Mr X
  • 133
  • 1
  • 11
  • Would you mind posting a link to the site? It would be interesting to see if there is anything specific causing the issue. – tw16 Jul 17 '11 at 00:46

2 Answers2

2

It is quite easy to do. Put this code directly after your opening <head> tag:

<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

What this does is forces the browser to use the highest standards it has available to it.

tw16
  • 26,989
  • 7
  • 58
  • 62
  • That would be too easy...that's why I posted the question ;] – Mr X Jul 17 '11 at 00:30
  • P.S. I guess the right solution would be - "IF the code runs in IE 7 then MAKE IE 7 run in IE 6 mode" By the way - what a great load of nuisance are those modes in IE / buttons - why are there in the first place ? I love IE but - this is unbearable... – Mr X Jul 17 '11 at 00:38
  • Well yes, but your actual question was "My question is - how can you make the layout ok when one presses compatibilty button in IE 9". That code there would answer the question. – tw16 Jul 17 '11 at 00:43
1

All versions of Internet Explorer have different sets of rendering bugs, and the older the browser, the more bugs there are.

If you are developing a site so that it looks good in IE, you have most likely taken advantage of some of the rendering bugs. This means that it will look different in another version of IE, and it will look completely warped in any browser that better follows the web standards.

You should not take advantage of the rendering bugs, but instead avoid things that works differently in IE compared to other browsers. That way it's possible to build sites that both work in different IE versions and also in other browsers.

You should have another browser to test in also, like Firefox, Chrome or Opera. Also verifying the HTML and verifying the CSS are also good tools for finding problems with the code.

You should not bother about the compatibility button. That is for pages that can't cope with standards compliance mode. If your page renders correctly in standards compliance mode, then you can add the meta tag that disables the compatibility button.

Community
  • 1
  • 1
Guffa
  • 640,220
  • 96
  • 678
  • 956
  • Ok - I always seem to come across issues only with IE 7 - not with any other IE or FF. The site I am coding now looks perfect in every sense in FF and all IE apart from IE 7 or when I press Compatibility button in IE 9. So of course I tried every possible meta tag I think - but to no avail...it looks like IE 7 interprets css differently or jQuery... – Mr X Jul 17 '11 at 00:32
  • Thank you guys for comments ! – Mr X Jul 17 '11 at 00:43