Conditional CSS for Opera

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Conditional CSS for Opera

Post by Pazuzu156 »

I know there is the <!--[if IE 7]> for IE, but what is the once for Opera if there is one?
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Conditional CSS for Opera

Post by Weirdan »

There's none as far as I know. You'd better be styling based on browser capabilities rather than based on user agent though, with something like Modernizr
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Conditional CSS for Opera

Post by social_experiment »

I found this on the site below

Code: Select all

if (window.opera) { document.getElementById('foo').style.height = '100px'; }
how-to-make-a-css-if-opera-not
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Conditional CSS for Opera

Post by social_experiment »

clint_psoriasis wrote:If you properly built your CSS its run properly in all browser.
Not quite, even if you have correct CSS not all browsers (not yet anyway) display the style rules exactly the same. Hence conditional options.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Conditional CSS for Opera

Post by Pazuzu156 »

It's just that some CSS won't work with Opera like Firefox and Chrome. But I'll probably just stick with the JavaScript to style it for now. Thanks anyways.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply