My site is rendering differently on machines running IE8 and XP and the same version of IE8 and Vista (what a surprise!)

How do I conditionally point the site to different css to account for the variations between XP/Vista/7

  • Compatabillity mode off on both machines. A simple vertical navbar aligns tight to the left of its Div box as expected on machine running IE6/XP IE8/Vista but has a 20px indent on another machine running IE8/XP. Obviously very simple to correct, but I have no idea why the indent should occur on the IE8/XP machine. Ian Hopkinson about 8 years ago
  • Usually if the same browser renders a page differently on different systems it has something to do with fonts or user configurations, but that doesn't sound like the case here. You can take a closer look at why IE8 does what it does if you press F12 to open IE's developer tools. If you post a code sample here (or link to the site if it's live) I'm sure people would be happy to take a look. Michael Martin-Smucker about 8 years ago

3 answers


This seems odd. Perhaps you have compatibility mode on in one of the browsers.

You will have to user agent sniff with javascript if you want different CSS for different operating systems. But note that generally speaking, sniffing is considered bad practice.

Some articles about user agent sniffing:

Answered about 8 years ago by Abinadi Ayerdis

Thanks guys. The simple answer is that the middle machine is actually running IE7/Vista. This means a much simpler fix between IE versions using conditional ifs.

We too thought that this was odd. It was not obvious that the machine was not running IE 8. Your scepticism made us realise that this was not a common problem and to check the obvious, which we should have done in the first place!

Thanks again.

Answered about 8 years ago by Ian Hopkinson

Marked as spam post. Link edited out. Original post follows. --Ktash

yes this is a right best answer this .
[Gripper Clippers][1]

Answered about 8 years ago by Gaylorde