在服务器上找不到CSS文件 [英] Can't find CSS files on server, when they are there
问题描述
我有header.html,它有这样的代码:
< link rel =stylesheettype =text / csshref =/ header_style.css>
在public_html目录中,与header.html文件具有相同的目录,我有<$ c
$ b
$ b
它设法找到所有图像,如下链接:
< img src =/ images / logo.png/>
所以我不知道为什么找不到我的CSS文件。
有什么想法?
尝试移除 / $在你的
链接
到 header_style.css中的
href
This all worked fine when running a local server.
I have header.html, which has this code:
<link rel="stylesheet" type="text/css" href="/header_style.css">
In the public_html directory, the same directory as the header.html file, i have the header_style.css
file.
It manages to find all images, linked like so:
<img src="/images/logo.png"/>
So I don't know why it's having trouble finding my CSS file.
Any ideas?
Try removing the /
at the beginning of the href
in your link
to header_style.css
. It's not required and some servers may interpret this as 'return to root' which may or may not be the directory you expect it to be.
这篇关于在服务器上找不到CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!