Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » General Web Development Discussions

Discuss general web development related issues. For Opera bugs, use the Bug Report Wizard: https://bugs.opera.com/wizard/. For Opera feature requests and queries, use Desktop wish-list: http://my.opera.com/community/forums/forum.dml?id=24.

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By mefano anchor Friday, 18. September 2009, 22:29:03

avatar

Browser detect conditional statement

Hi,

I've been working on improving my cross-browser compatibility and have run into some issues. I started in IE and the CSS for it. Of course, it looks different in Opera and FF. I created a second CSS and used an IF statement to load the first one for IE only. The new CSS fixed the FF issues, but not the Opera issues. I would like to use another IF statement to load the CSS for Opera, but it isn't working.

The below works to specify IE, but when I try the same thing for Opera it's a no-go.

[if IE]
<link rel="stylesheet" type="text/css" href="new_ie.css" />
[endif]

The site is at www.adam-k-watts.com if you want to see it. I am trying to correct some positioning and font-size issues.

Once all that is done, maybe I will try to figure out why the JS that displays times from all over the world only works in IE. But first things first.

If anyone can help me out, I would greatly appreciate it.

Thanks.

By andreasbovens O anchor Saturday, 31. October 2009, 02:46:30

avatarThese conditional statements are an IE only construct, and won't work in other browsers. Rather than using browser-specific CSS, you should try to write cross-browser CSS - if you have any specific difficulties, feel free to share links to testcases etc, so we can help out.

Moderators: pepelsbey | dstorey | mcx | operadev | chrismills | shwetankdixit | brucelawson | iheni | andreasbovens | zibin | mollydotcom