Search code examples
cssinternet-explorercross-browserconditional-statementsquirks-mode

Is there a way to condition a CSS styling to execute only on IE quirks mode?


I want to write a cross-browser widget, to integrate both to IE standard and quirks mode pages (FF is easy of course).

Since I want to write the styling only once I would like to condition some styling statements to execute only in quirks/standard mode.

Is there a way t do so?

As far as I understand, both the _ hack and IE conditional comments only allow me to distinguish between different browsers, not different browser modes.


Solution

  • var isIeQuirksMode = (document.all && document.compatMode !== 'CSS1Compat');
    alert('In quirks mode: ' + isIeQuirksMode);