在我的网页上,我在 <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/