drelgkxl93433 2017-05-02 05:42
浏览 100

前往:HTML找不到CSS档案

So i'm writing a web application in Golang. The html references a css file like so: <link href="/css/index.css"..., but the css file is never found!.

Here is the bummer though, i have a couple of css files and they are all in the same folder, and they all work!.

If i create another css file and name it index2.css and copy the contents of index.css into index2.css, this works perfectly, but for some reason, the name index.css does not work!

Also, when i go to the link http://localhost:8080/css/ this list all my css files. If i click on any of them, it opens up perfectly except index.css; i get a 404 not found.

This is really strange, any idea what could be the problem?

All files in css folder:

enter image description here

index.css not found:

enter image description here

<head>
    <title>Title</title>
    <link href="/css/index2.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="icon" type="image/png" href="/images/img.png"/>
    <script src="/scripts/jquery.min.js"></script>
    <script src="/scripts/scroll.js"></script>
</head>

When i like to <link href="/css/index2.css" rel="stylesheet"... i can see the css style on my page. When i link to <link href="/css/index.css" rel="stylesheet"... i can't.

index.css exists in my folder:

enter image description here

EDIT

It works now. I think it was a permission issue. I deleted the old index.css and created a new one and it works now. Thanks for the help.

  • 写回答

2条回答 默认 最新

  • dongzhi6463 2017-05-02 06:31
    关注

    May be this problem is because of -

    1.Temp file, try to find index.css~ file.If using Ubuntu then go to the css folder and press ctrl+H. then you will see the temp file if it is there.

    2.May be path is not correct.

    3.May be file got corrupted, try to delete and create new index.css

    4.Provide your source code to debug your issue.

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)