Deka87 Deka87 - 1 year ago 98
CSS Question

Detect browsers that are NOT IE 10+

I know that I can detect IE 10+ with the following media query:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */

I helps me write IE specific code if needed. The question is how do I write code for any other browser, except for IE10+? Something like if not @media ... { my code here }

PS: I know these are dirty tricks, but I am totally lost.

Answer Source

The simplest thing would be to declare the common styles and styles for all non-IE10+ browsers before that media query, then override them as necessary within the media query to make whatever changes IE10+ require.

If you need to target specific browsers these will get you anything Webkit and Firefox respectively:

@supports (-webkit-appearance:none) {
    Styles Go Here for Safari and Chrome

Firefox is a bit messier:

_:-moz-tree-row(hover), .classname {
    Styles Go Here

Repeated for each class/id/whatever