1

Background Information

I have a webpage with 10 subpages, which use the same basic HTML and CSS.

The first 5 pages have this code in the <head> section:

<link rel="stylesheet" type="text/css" href="./MainConfig/MAINCSS.css">
<script language="javascript" src="./MainConfig/Copyrights.js"></script>
<script type="text/javascript" src="./JS/CL.js"></script>

...and the other 5 have the same:

<link rel="stylesheet" type="text/css" href="../MainConfig/MAINCSS.css">
<script language="javascript" src="../MainConfig/Copyrights.js"></script>
<script type="text/javascript" src="../JS/CL.js"></script>

Problem

However, the CSS is not working. Strangely, many people have had the same problem. Despite searching css not working in gitwebpages, the only results I have found were about mistyping the location or using \ insted of /.

The JavaScript is working fine but the CSS is not. Also, it works fine in localhost.

Any thought on this? Thanks in advance!


Extra Information

File structure

Root
 |
 +----- readme.md
 |
 +----- index.html
 |
 +----- GrLang
 |
 +----- EnLang
 |
 +----- img
 |
 +----- JS
 |       |
 |       +----- CL.js
 |
 +----- MainConfig
            |
            +----- MAINCSS.css
            |
            +----- Copyrights.js

Error

Failed to load resource: the server responded with a status of 404 (Not Found)
4
  • Please can you add your file structure. Also, in the DevTools, does it come up with any errors? Commented Feb 3, 2020 at 21:46
  • I have a main folder of the webpage which includes the index.html,readme, and 4 folders (GrLang,EnLang,img,js and main config) The index html goes directly to mainconfig <link rel="stylesheet" type="text/css" href="./MainConfig/MAINCSS.css"> while the subfolders in langages (Gr and En) <link rel="stylesheet" type="text/css" href="../MainConfig/MAINCSS.css"> I have tried changing to "MainConfig/MAINCSS.css" and "MyTestWebsite/MainConfig/MAINCSS.css" but it had the same result The browser console show -> Failed to load resource: the server responded with a status of 404 () Commented Feb 4, 2020 at 10:24
  • Please can you edit the question and put the information in there. It is better to edit the question so that people don't have to go searching through the comments. Commented Feb 4, 2020 at 15:52
  • Is the file structure I have constructed accurate? Please correct any cases, as file names are case-sensitive. Commented Feb 4, 2020 at 16:55

1 Answer 1

1

I have contact the support and the code was correct, although there was server-side problem which the support fixed.

Thank you guys for taking time to help !!!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.