PDA

View Full Version : How to include this file?



AlCapwn
Mar 18th, 2010, 11:18 PM
So in the main folder it has most of the pages and the style.css but I also have another folder in there with about 7 more pages. So how would I include the style.css that is in the parent folder?

Excavator
Mar 19th, 2010, 12:50 AM
Hello AlCapwn,
You would add a link to your style.css in the head of each of your 7 documents. Even though your other pages are in a different directory than your pages in the main folder, you can still link to the same .css file.

Have a look here - http://www.w3schools.com/css/css_howto.asp

AlCapwn
Mar 19th, 2010, 01:02 AM
Hello AlCapwn,
You would add a link to your style.css in the head of each of your 7 documents. Even though your other pages are in a different directory than your pages in the main folder, you can still link to the same .css file.

Have a look here - http://www.w3schools.com/css/css_howto.asp

I do have them linked to the style.css, but they still don't work.



<link href="style.css" rel="stylesheet" type="text/css" />

Excavator
Mar 19th, 2010, 02:03 AM
<link href="style.css" rel="stylesheet" type="text/css" />
[/QUOTE]

That is linking to a style.css in the SAME directory as the .html document. If your working in different directorys, you have a path issue... assuming everything is spelled correctly.

It could be a link like this is needed - "foldername/style.css"
or this - "/foldername/style.css"
or this -or this - "../foldername/style.css"
and could even be a couple directories deep like this - "../../foldername/style.css"

AlCapwn
Mar 19th, 2010, 03:18 AM
I've already tried that earlier and it does not work. Here is where the files are

Main Folder - where style.css is located
>>2nd Folder
>>>>File that won't include style.css

Excavator
Mar 19th, 2010, 03:24 AM
<link href="../style.css" rel="stylesheet" type="text/css" />

That should do it. If not, give us a link to the test site and we can figure it out.

AlCapwn
Mar 19th, 2010, 04:05 AM
<link href="../style.css" rel="stylesheet" type="text/css" />

That should do it. If not, give us a link to the test site and we can figure it out.

Thanks, that worked.