...

View Full Version : CSS Imports in NS



bluephoenix
01-10-2003, 05:08 PM
I'm not going to say which browser I like better... but here's my dilemma. My style-sheets function as desired in IE, but not NS. So I've decided to use a little javascript to import a different external css depending on the browser. Yet, I can't get an external css to work in NS by either <link> or @import. Any suggestions?

jkd
01-10-2003, 05:15 PM
Can we see the page?

If the doctype triggers standards compliant mode, your stylesheet *must* be served as text/css. Many misconfigured servers server them as text/plain, which is wrong.

@import, <link/>, and <?xml-stylesheet?> all work fine in NS6+, so that's not the problem. I'm willing to bet on the mime-type.

bluephoenix
01-10-2003, 06:28 PM
well we haven't posted anything to the server, yet. This is just being read by the browser from the harddrive.

My DOCTYPE is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

my javascript code to select the CSS is:

<script language="javascript" type="text/javascript"><!--
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
document.write("<style><!--@import url(msiecss.css);--></style>"); }
else {
if (browser=="Netscape") {
document.write("<style><!--@import url(nscpcss.css);--></style>"); }
//--></script>

bluephoenix
01-10-2003, 06:30 PM
never mind. I figured it out.

:o let's just say {'s are not my friend anymore.

:)

Grant Palin
01-10-2003, 07:48 PM
How's that?

chrismiceli
01-11-2003, 04:41 AM
Originally posted by bluephoenix
<script language="javascript" type="text/javascript"><!--
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
document.write("<style><!--@import url(msiecss.css);--></style>"); }
else {
if (browser=="Netscape") {
document.write("<style><!--@import url(nscpcss.css);--></style>"); }
}
//--></script>

just showing great plain the error.

bluephoenix
01-11-2003, 04:56 AM
just showing great plain the error.

Some could argue the error is as follows:

<script language="javascript" type="text/javascript"><!--
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
document.write("<style><!--@import url(msiecss.css);--></style>"); }
else if (browser=="Netscape") {
document.write("<style><!--@import url(nscpcss.css);--></style>");
}
//--></script>

:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum