Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browser specific css

Status
Not open for further replies.

Nexusens

Programmer
Feb 6, 2007
22
CA
I know the browser detection is woorking but what am i doing wrong when calling my css file?
<script type="text/javascript">
css = new array()
<!--
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{css = "StyleIE.css";}
else if (browserName=="Netscape")
{css = "StyleNS.css";}
else if (browserName=="Opera")
{css = "StyleO.css";}
//-->
function css{document.getElementById("css").href = css;}
</script>
<link href="Style.css" rel="stylesheet" type="text/css" id="css"/>

"Tsune ni ite, kyu ni awasu
 
I see a bunch of problems with your javascript, but I think you should take those problems to forum216. As for the general question, why do you need to do that? Opera and FF should not differ in display as well as IE7 and for IE6 and older browsers you would be better off using [google]IE conditional comments[/google].
 
I am using browser detection because my css file works just fine in IE7 but is screwy in ff ns and opera.
I have a seperate file for ff and opera because getting a slight size discrepency between ff and opera that screws over my nav bar. I am fairly new to web programming, if there is somthing in my code that is causing these problems let me know please. however I will repost in forum 216

"Tsune ni ite, kyu ni awasu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top