3

I am currently using @media screen and (-webkit-min-device-pixel-ratio:0) to target Webkit browsers + Opera 9.2.

Is there a safe* way to target Opera GTE 9.5 or LTE 10?

* won't be picked up by another browser

TylerH
  • 20,799
  • 66
  • 75
  • 101
Knu
  • 14,806
  • 5
  • 56
  • 89
  • 2
    Maybe you can explain what the real problem is (i.e. the issue you're trying to hack around)? Hacks are ugly and in my experience, rarely necessary. – DisgruntledGoat Feb 11 '10 at 16:48
  • just trying to get the same visual rendering for a form // it's quite challenging (the legend element for example) // misplaced labels and inputs // my target would be 9.5-10 – Knu Feb 11 '10 at 21:33
  • Can you give a more concrete example of the rendering difference ? – Zitrax Feb 12 '10 at 20:10
  • btw it's fixed in op 10.5 // negative margin-top on inputs and legend - but i can't feed it exclusively to op 9.5-10 – Knu Feb 13 '10 at 11:04

2 Answers2

3

That was hard but here it is. Works only in Opera gte 9.5 and lt 10.50:

@media all and (resolution = 0dpi) { // exclude Opera 10.50 and higher
  :root #box { // you need to append :root to all selectors to exclude Opera lt 9.5
    background: #f00;
  }
}
Sam Dark
  • 5,291
  • 1
  • 34
  • 52
  • Yes, it is targeting only Opera. FF ignores it. Just try. – Sam Dark Feb 23 '10 at 13:01
  • The key there is "0dpi" which seems to be "supported" but returned as true by all Opera versions < 10.50. – Sam Dark Feb 23 '10 at 18:21
  • you didn't correctly pinpoint the culprit (it's related to http://www.w3.org/TR/css3-mediaqueries/#error-handling) // ill accept your solution if no one comes with something better and valid // you can use `(1)` – Knu Feb 24 '10 at 03:26
0
* targets Opera 9 & below (and perhaps future versions) - valid HTML & invalid XHTML */

#dis[disabled="true"]+p {}

Source: http://perishablepress.com/press/2006/08/27/css-hack-dumpster/

Sarfraz
  • 377,238
  • 77
  • 533
  • 578