-1

I started to use Linux recently, when I want to edit some html files, the css file cannot be linked to the html file.

For example, link rel="stylesheet" href="/zixucheah331/css/index.css"

Previously, it works on my Windows 0S. But now it shows "Failed to load resource: net::ERR_FILE_NOT_FOUND" in the console. Any solution from professional Linux users??

Cheah Zixu
  • 40
  • 6
  • "File Not Found" is pretty clear. Your URL must be wrong. – Quentin Dec 12 '17 at 14:00
  • 1
    You've got the wrong URL for the CSS file. Little to do with Linux versus Windows - understand your file structure and how it relates to your URLs. – ceejayoz Dec 12 '17 at 14:01
  • Are you running a local server or just opening the files directly in the browser? If it's the latter, then referencing root "/" won't work. – delinear Dec 12 '17 at 14:19

1 Answers1

-1

Your style sheet is not found by your brower.

Change the href to :

href="css/index.css"

Doing that, your browser should search relatively from the path of your page. So this will work if you have : index.html css/index.css

As it is likely to be the case, you will have your problem temporary fixed.

temporary only, as if you have pages in another structure, you will have to adapt the path - so it is not optimal :

index.html
event/index.html
event/super-event.html

in super-event, the address will be

href="../css/index.css"

More info on : relative path to CSS file

Cedric
  • 5,135
  • 11
  • 42
  • 61