Forum Moderators: not2easy
/
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.
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.