Css链接无法正常工作? [英] Css link not working?
问题描述
嗯,这是一个我认为我已经过时的问题了。我似乎无法将我的CSS文件链接到我的HTML页面。实际上,我已经将两个页面连接到同一个CSS文件。
当只有第一个文件连接到CSS时,它可以工作。当我连接第二个时,第一个仍然有效,但第二个有一个错误,上面写着'错误:无法加载资源'。两个HTML文件中都没有出现类名,第一个文件没有错误。我不明白为什么第一个文件可以工作,但不能用第二个文件。
我向你保证文件名都是相同的;这不是一个错字。
我的CSS文件现在称为CSS.css。可怕的名字,我知道,我稍后会更改。
谢谢。
我尝试过:
更改文件的名称并以新名称重新连接HTML文件。
Well, here's a problem I thought I outgrew. I can't seem to link my CSS file to my HTML page. Actually, I have connected two pages to the same CSS file.
When only the first file is connected to CSS, it works. When I connect the second, the first one still works, but the second one has an error that says 'error: failed to load resource'. There are no class names that appear in both HTML files, and there is no error with the first file. I don't understand why with the first file it works, but not with the second.
I assure you that the file names are all identical; it's not a typo.
My CSS file is called CSS.css for now. Terrible name, I know, I'll change it later.
Thank you.
What I have tried:
Changing names of the files and reconnecting HTML files under that new name.
推荐答案
我会抓住你的问题: 你的两个文件在同一个文件夹中?更具体地说,它们是否在相对于CSS文件的相对位置?
文件的位置(通常)在您的网站文件夹中,而不是你从哪里调用它。
I'll take a stab at your problem: are your two files in the same folder? More specifically, are they in the same relative location relative to the CSS file?
The location of a file is (usually) where it is in your website folder, not where you call it from.
这篇关于Css链接无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!