Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

57 users online



@import is driving me insane.

@import is driving me insane.

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 2
sinsation

sinsation

23, mother, art slave, code monkey
Status: Offline!

@import is driving me insane.

I have this little tidbit in my index file:

Code:

<link rel="stylesheet" type="text/css" href="dijitalsin_mutedregrets.css" media="all">
<style type="text/css" media="all">
<!--
@import: url('dijitalsin_mutedregrets.css');
-->
</style>


The stylesheet link works perfectly for IE but for the love of code FB is hating @import at the moment. Did I miss something?

Site is here: http://sineptor.port5.com

___________________

And the sig ran away with the spoon.

Gichin_Funakosh

Gichin_Funakosh

Status: Offline!

Remove the comment tags (<!-- and -->); they'll cause some browsers to (correctly) treat the @import command as a comment, and therefore not parse it.

@import, by the way, is not like traditional CSS commands. No colon should be present, and browsers that correctly follow W3C recommendations (e.g. Firebird) will choke on it and not parse the line.

Also, its good practice to not use quotation marks when including something via URL in CSS, as doing so can cause errors in certain browsers.

So, in totality, replace your code with:

Code:


<link rel="stylesheet" type="text/css" href="dijitalsin_mutedregrets.css" media="all">
<style type="text/css" media="all">
@import url(dijitalsin_mutedregrets.css);
</style>

and it should work correctly.

And, might I ask, why are you importing the same stylesheet twice, once with link and once with @import?

fredmv

fredmv

Status: Offline!
Quote:

Originally posted by Gichin Funakosh
And, might I ask, why are you importing the same stylesheet twice, once with link and once with @import?


I would imagine because some browsers don't support it. Although that's actually the advantage of using it (primarily to hide the CSS from Netscape 4.x and other browsers in which have poor CSS support).

___________________

http://home.comcast.net/~fredv4/tf/firefox.gif

Gichin_Funakosh

Gichin_Funakosh

Status: Offline!
Quote:

I would imagine because some browsers don't support it. Although that's actually the advantage of using it (primarily to hide the CSS from Netscape 4.x and other browsers in which have poor CSS support)

No, that would be the advantage of including two different stylesheets, one via link (typically a less advanced stylesheet that can be parsed by NSN 4.x) and one via @import (for modern, standards-compliant browsers).

As far as I know, including the same stylesheet twice accomplishes nothing, and I suspect might even cause some browsers to choke. That's why I asked Mel what his intentions were---perhaps he was trying to do what you describe, but accidentally forgot to include two unique stylesheets.

fredmv

fredmv

Status: Offline!

Good point, that just may be the case.

___________________

http://home.comcast.net/~fredv4/tf/firefox.gif

sinsation

sinsation

23, mother, art slave, code monkey
Status: Offline!
Quote:

Originally posted by Gichin Funakosh

Code:


<link rel="stylesheet" type="text/css" href="dijitalsin_mutedregrets.css" media="all">
<style type="text/css" media="all">
@import url(dijitalsin_mutedregrets.css);
</style>


Tried that, doesn't work.

Quote:

And, might I ask, why are you importing the same stylesheet twice, once with link and once with @import?


Because I thought IE reads the link and moz/fb reads the import? Was I wrong in this?

Problem could be with my css, because that brown bgcolor and font/link options show fine. I may have other tags that fb doesnt recognize. My stylesheet is here: http://sineptor.port5.com/dijitalsin_mutedregrets.css

___________________

And the sig ran away with the spoon.

Last edited by sinsation, December 23rd, 2003 04:47 AM (Edited 1 times)

fredmv

fredmv

Status: Offline!
Quote:

Originally posted by sinsation
My stylesheet is here: http://sineptor.port5.com/dijitalsin_mutedregrets.css


From your external stylesheet:

Code:

<STYLE type="text/css">
<!--

Code:

-->
</STYLE>

Remove that code. Only CSS code belongs in an exteral stylesheet (just like only JavaScript belongs in an external JavaScript source file).

___________________

http://home.comcast.net/~fredv4/tf/firefox.gif

sinsation

sinsation

23, mother, art slave, code monkey
Status: Offline!

Dude!
I love you. lol

___________________

And the sig ran away with the spoon.

fredmv

fredmv

Status: Offline!

No problem. :santa_gri

___________________

http://home.comcast.net/~fredv4/tf/firefox.gif

Rad

Rad

thinking of something witty to put here
Status: Offline!

A little tip: Use @import "yo.css" to hide from 4.0 browsers.

Code:


<style type="text/css">@import "bagpipefestivalhomepage.css";</style>

Page 1 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0098 seconds.