在服务器上找不到CSS文件 [英] Can't find CSS files on server, when they are there

查看:479
本文介绍了在服务器上找不到CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有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 / code>。这不是必需的,一些服务器可能会将其解释为返回到根目录,这可能是也可能不是您期望的目录。


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆