简体   繁体   English

为什么我的 CSS 文件没有链接到我的 HTML 文件?

[英]Why are my CSS files not linking to my HTML files?

I am currently facing a problem of not being able to link my CSS files to the HTML files that are located in the same folder.我目前面临无法将我的 CSS 文件链接到位于同一文件夹中的 HTML 文件的问题。 About a year ago, I did a project where I built a simple website using HTML and CSS.大约一年前,我做了一个项目,使用 HTML 和 CSS 构建了一个简单的网站。 Now when I download the folder from my Google Drive and try to open the HTML file with Chrome, I see that the CSS effect is not applied.现在,当我从 Google Drive 下载文件夹并尝试使用 Chrome 打开 HTML 文件时,我发现未应用 CSS 效果。 However, after going back to the folder to open and close the corresponding CSS file, when I try opening the HTML file again, then the CSS effect is shown.但是,回到文件夹打开和关闭相应的CSS文件后,当我再次尝试打开HTML文件时,就会显示CSS效果。 I have no idea why this is happening but does anyone have any idea?我不知道为什么会这样,但有人知道吗? I have a folder called snappers and inside that folder, I have three different folders, one that stores HTML files, one that stores CSS files, and one that stores images used for the website.我有一个名为 snappers 的文件夹,在该文件夹中,我有三个不同的文件夹,一个存储 HTML 文件,一个存储 CSS 文件,另一个存储用于网站的图像。

根据您的文件夹结构,您必须向上一级目录才能访问 css 文件夹:

"../css-folder/css-file.css"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM