4

Possible Duplicate:
How to make CSS visible only for Opera

Many times I need to use browser specific CSS rules to make the design look alike in every browser. Generally I need them for IE 7-8, but this time is for Opera, specifically Opera 12 and on.

I found some solutions for Opera:

But these only work for 11 or below...

Is there a solution for Opera 12?

TylerH
  • 20,799
  • 66
  • 75
  • 101
I.G. Pascual
  • 5,818
  • 5
  • 42
  • 58
  • 3
    "Many times a need to use browser specific CSS rules to make the design look alike in every browser." No. – BoltClock Sep 12 '12 at 13:53
  • 3
    There is never a need to be identical in every browser, that attitude really should have died years ago. Presto is a pretty good engine, are you absolutely 100% certain the error is not yours? You've provided no code showing otherwise. – cimmanon Sep 12 '12 at 14:01
  • Generally speaking you do not need hacks, there's always a clean solution. If you want to talk specifics of what the best clean solution is, we need a specific problem case. – deceze Sep 12 '12 at 14:20
  • 1
    @cimmanon How could You know that? I use rem units to keep my my design responsive and accessible, but still I want it to look alike in all browsers. However damn Opera doesn't seem to know what relative means. My navigation are background are no aligned properly despite my best efforts. Under (FF, Chrome and surprise - IE9) all works fine. I can easily change size of browser's font and it works. In Opera ... even with specific CSS ... all hell breaks loose when I try to change font from default 14px... I stopped wondering why Opera's market share is only ~2% ... – op1ekun Jan 01 '13 at 22:52
  • 2
    The simplest example: when a part of the design depends on native scrolling bars width, you need to apply browser specific rules... – I.G. Pascual Jan 02 '13 at 00:33
  • 1
    @cimmanon Look at this one: http://stackoverflow.com/questions/14126088/inaccurate-rem-units-in-opera12-and-ie9 and tell me what I'm doing wrong. It's not a challenge (I'm not omnipotent I know I make mistakes)... – op1ekun Jan 04 '13 at 21:19

1 Answers1

12

Here is an officially recommended hack for Opera (in case everything else fails):

doesnotexist:-o-prefocus, .example {
  color: red;
}

http://www.opera.com/docs/specs/presto2.12/css/o-vendor/

via: https://stackoverflow.com/a/4021618

p.s.: notice comment by davehale32, that this hack does not work for IE6. I have no IE6 at my disposal now, so i can't confirm or deny that.

Community
  • 1
  • 1
c69
  • 19,951
  • 7
  • 52
  • 82
  • Just checked `55.0.2994.44` and it does not work anymore... – Daniel Fisher lennybacon Sep 06 '18 at 13:13
  • 1
    all "opera-only" hacks were targeting Presto engine which was abandoned after Opera 12.50. All versions newer than 14 use Blink engine (fork of Webkit), so for all pragmatic cases the same CSS that you use for targeting Google Chrome should work for Opera as well. – c69 Sep 10 '18 at 17:30