CSS外部工作表需要完整的路径链接而不是文件夹路径。为什么?
与我的代码的第8行一样,我应该能够链接到样式我需要在附近的文件夹中。但是,那行不通,我需要完整的路径。
在我关注的在线课程中,讲师的工作方式除外,除了他们使用CSS/样式。CSS我认为,因为它们在Mac上。我做CSS \ styles.css,因为我在Windows上。
另外,即使我尝试在文件夹中更高,例如执行Web Development \ css \ styles.css.css,这也行不通。它只有在我一直回到C等时起作用。
更新:删除< html lang =“ en” dir =“ ltr”>
修复了它,但是为什么呢?
有技巧吗?
As with line 8 of my code, I should be able to link to the style sheet I need in a neighboring folder. But, that doesn't work and instead I need the full path.
In the online course I'm following, the instructor has it work that way except that they use css/styles.css I think because they're on a mac. I do css\styles.css because I'm on windows.
Also, even if I try going higher in the folders like doing Web Development\css\styles.css, that doesn't work either. It only works when I go all the way back to C: and so forth.
UPDATE: deleting <html lang="en" dir="ltr">
fixed it, but why?
Any tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
index.html
文件中没有CSS文件夹,您可以使用..
将文件夹向上转到文件夹,然后进入css
文件夹并选择style.css
文件。there is no css folder adjacent to the
index.html
file, you can use..
to go folder up and then go into thecss
folder and select thestyles.css
file.在您的代码中,没有像您的代码这样的文件路径尝试此路径
&lt; link rel =“ stylesheet” href =“/css/css.css”&gt;
in your code, there is no such file path like your code try this one
<link rel="stylesheet" href="/css/css.css">