Click here to Skip to main content
15,309,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Well, here's a problem I thought I outgrew. I can't seem to link my CSS file to my HTML page. Actually, I have connected two pages to the same CSS file.

When only the first file is connected to CSS, it works. When I connect the second, the first one still works, but the second one has an error that says 'error: failed to load resource'. There are no class names that appear in both HTML files, and there is no error with the first file. I don't understand why with the first file it works, but not with the second.

I assure you that the file names are all identical; it's not a typo.

My CSS file is called CSS.css for now. Terrible name, I know, I'll change it later.

Thank you.

What I have tried:

Changing names of the files and reconnecting HTML files under that new name.
Posted
Updated 22-Jan-18 6:59am
Comments
David_Wimbley 21-Jan-18 22:06pm
   
Can you provide some html so we can see how your linking your CSS files in the html?
Suvendu Shekhar Giri 21-Jan-18 22:13pm
   
Please show the relevant section from html.
[no name] 22-Jan-18 0:45am
   
Please provide the html code snippet of both the html files where you are referencing the css file and also let us know if both the HTML files reside in same folder or not.Some times what it happens is that you will copy the CSS reference given to first page and paste it in second page but some how your second page resides in some other folder which required a proper mapping of your css file.

1 solution

I'll take a stab at your problem:   are your two files in the same folder? More specifically, are they in the same relative location relative to the CSS file?

The location of a file is (usually) where it is in your website folder, not where you call it from.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900