I’m finding it impossible to layout and position elements on a website using CSS that will behave the same in both IE8 and Firefox. Is there anyway for my HTML pages to detect what browser the site visitor is using and call different CSS files accordingly? What works in one doesn’t work in the other, and the more complex the design gets, the worse the disparity. It’s driving me nuts.
2 Comments to “Calling different CSS stylesheets depending on IE or Firefox?”
No related posts.
Filed under CSS HTML Design HELP




answer
http://answers.yahoo.com/question/index;_ylt=Atxl5ZCJ1kuZJkwkHcGx6I3sy6IX;_ylv=3?qid=20100617155408AARPAC5
Well w3schools has a tutorial on using javascript to find out what browser a user is using:
http://www.w3schools.com/js/js_browser.asp
Combine that with this script I found on Google:
http://www.tizag.com/javascriptT/javascriptredirect.php
Then, just simply add the script at the top. If its IE, launch the redirect code to a page that has the IE style sheet, and if its anything else, just keep it on the current page.
You might also be able to just use the javascript and do something like “If the browser is IE link this style sheet” and “else this style sheet” but I’m not a genius at web design and have no idea if that would work or if its the right way to do it.
ex.
a = browser.whateverthecodeisforfiguringoutthebrowser
if a=”Internet Explorer 8″
else
Those are the only two ways I can think to do it. Good luck, hope this helps.