html - Firefox 无法使用绝对文件路径找到外部 CSS

标签 html css

在我的网页上,我在 <head> 中有以下行元素:

<link type="text/css" href="C:/myApps/app1/images/css/12.02/main.css" rel="stylesheet" />

当我在 Firefox 11.0 中查看该页面时,很明显 main.css没有被加载。如果我去查看页面源代码,我会看到 <link> HTML 中的元素(上方),但是当我单击它时出现以下错误:

Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program.

我该如何解决这个问题?

最佳答案

尝试:

<link type="text/css" href="file:///C:/myApps/app1/images/css/12.02/main.css" rel="stylesheet" />

可能有用

编辑:根据其他答案,这是当您想在本地计算机上使用 css 文件时,如果要托管网站,则需要使用相对路径。

<link type="text/css" href="images/css/12.02/main.css" rel="stylesheet" />

上面假设您的带有链接的 html 文件位于您的“app1”文件夹中。

马丁

关于html - Firefox 无法使用绝对文件路径找到外部 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10293579/

相关文章:

html - 为什么我的 CSS 不呈现?

html - 面向开发人员的谷歌 chrome 图形修复

javascript - 如何在 INPUT FIELD 而不是 SPAN 中将变量显示为总计?

html - 在两个表格行之间居中放置一个按钮

html - 新页面链接到菜单栏,html

css - 使用背景图像并在其顶部应用 CSS 动画

c# - 在 .Net 中将 Html 转换为 Word

python - 无法使用reverse_lazy链接静态网页

html - 如何使用 CSS 降低元素背景的不透明度?

jquery - 同一列表中的 2 个不同的可排序项