Forum Moderators: not2easy

Message Too Old, No Replies

including css files

         

Fotiman

9:56 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Suppose my directory structure looks like this:

/
index.htm
styles/
main.css
nav.css

From index.htm, I want to ony link to main.css, and I want main.css to have an @import to include nav.css. My question is, what should the import statement look like?

I tried this inside main.css:

@import url("nav.css");

and I tried this:

@import url("./nav.css");

But neither method worked. Note also that I can't specify it as relative to the root directory because this might not be located in the root and I don't know before hand whether or not it will be. So I can't do something like this:

@import url("/styles/nav.css");

Any suggestions?
Thanks.

iamlost

10:47 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I tried this inside main.css:

@import url("nav.css");

Given your directory structure and presuming main.css is properly called your example should work - providing that it is the very first rule in main.css:

[w3.org ]


The '@import' rule allows users to import style rules from other style sheets. Any @import rules must precede all rule sets in a style sheet.

Fotiman

10:48 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nevermind. Typo on my part. Kudos to the Web Developer Toolbar for Firefox... it really helped me debug this problem.