Link to home
Start Free TrialLog in
Avatar of huji
hujiFlag for United States of America

asked on

Opera Hack

I want a line of CSS to only be applied in Opera 9 (or if possible Opera 8+) but not in Firefox or IE (or if possible other browsers like IEMac and Safari)

Is this possible through CSS hacks?
SOLUTION
Avatar of jfredrickson
jfredrickson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of huji

ASKER

I give an example. Check this page: http://fa.wikipedia.org/
Check it in IE and Firefox and Opera. Compare it with http://en.wikipedia.org/ (well you will need to hav Farsi installed to see the first page correctly.)
The first link from the tabs on the top of the page (equivallent to the "main page" tab in the English version) should appear with some space on its right, and it does except in Opera. Any idea how to fix it only in Opera?
Huji
Avatar of GrandSchtroumpf
GrandSchtroumpf

no idea, rtl layout is not my area...
that layout is quite complicated (using absolute positioning) and probably especially designed for IE and FF...
there are clearly some differences between Opera and Firefox, but i have no idea which browser is right and which browser is wrong.
Avatar of huji

ASKER

well, in this special case, and as much as I've understood it, Opera is not rendering the page in an standard way. I'll try to find a way myself. Thanks for letting me know of the fact that no Opera 8+ hacks are availabe.
Huji
>  well, in this special case, and as much as I've understood it, Opera is not rendering the page in an standard way.
IMHO, the page is too complicated to find out who's wrong and who's right.  The particular issue should be isolated.  Firefox also has bugs, especially with lists.


> Thanks for letting me know of the fact that no Opera 8+ hacks are availabe.
There are some hacks but they are hard to find.

You can use the fact that Opera 9 supports media-queries:
http://www.w3.org/TR/2002/CR-css3-mediaqueries-20020708/#media1

Example here:
http://www.positioniseverything.net/articles/onetruelayout/verticalgrid#how-opera-4

Now, for compatibility with future browsers, a good hack should be based on some wrong interpretation of the CSS syntax, not on a correct interpretation of the CSS syntax.
In this case, if Opera is wrong and you use the media-queries to fix the wrong, you'll get unwanted side effects when other browsers will start supporting media-queries.

Unless you know the hack very well and you are sure it will be compatible with future browsers, I recommend using javascript to check the user-agent and include some additional CSS for the particular browser you need to fix.
Avatar of huji

ASKER

Well, if it was up to me, I'd check the UA on the server side. I don't care about those who change the UA of their browser, they'd pay the cost of it. :)
Thanks for sharing the idea
Huji