Forum Moderators: not2easy

Message Too Old, No Replies

CSS and FireFox

         

rei2007

4:16 pm on Mar 23, 2007 (gmt 0)

10+ Year Member



Hi,
I am a beginer and have very few experience with html. I develop a program and I am using html files to write output reports for this program. The styles are in a css separate file. I have already validated both the css and the html files and they have no problems. In fact they are working well on FireFox as long as the CSS file is located in the same directory of the html. IŽd like them to be in separate directories, as there will be a single CSS and lots of html files, in different directories.

The code below works great:
<LINK href="Report.css" type="text/css" rel=stylesheet>

But if I use:
<LINK href="C:\Main\Report.css" type="text/css" rel=stylesheet>
FireFox seems not to find the file.
It works well on IE.

Could anyone help me please?
Thanks
Andrea

cmarshall

4:42 pm on Mar 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

<LINK href="C:\Main\Report.css" type="text/css" rel=stylesheet>

The red part is your problem. You are specifying a Windows-centric file path. This will not only screw up your CSS links, but any other links.

You need to specify paths in POSIX format, as if it were a UNIX system.

I usually use relative paths (

<LINK href="Main/Report.css" type="text/css" rel=stylesheet>
or
<LINK href="../Main/Report.css" type="text/css" rel=stylesheet>

Also, you should get in the habit of using XHTML-valid element names (<link, as opposed to <LINK). You should also wrap "stylesheet" in quotes.

Xapti

6:18 pm on Mar 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe you can also use "file:///C:/<rest of path>", if you wanted to use absolute paths instead of relative paths.

[edited by: Xapti at 6:22 pm (utc) on Mar. 24, 2007]

rei2007

4:38 pm on Mar 26, 2007 (gmt 0)

10+ Year Member



Thanks.
Both ways worked quite well.