【发布时间】:2022-12-09 15:33:00
【问题描述】:
我建立了一个 Edge Ledger 网站,使用 vs 代码做了 html 和 css 样式,当我在实时服务器上运行它时它工作正常,我所做的 css 样式已经实现但是如果我只是转到根文件夹并打开 index.html文件而不使用 vs 代码来运行它,它只显示没有样式的 html 元素。谁能帮忙?
i tried opening the index file without vs code, it just loads the html file without the css.
when i run this with live server on VS code the css styling i did is applied to the index html page
可能是什么问题呢?
【问题讨论】:
-
问题是您的 CSS href 以“/”开头,当您通过
file://协议查看文件时,浏览器会在根目录中查找css文件夹。解决方案是删除前导斜杠。 -
谢谢,你的回答很有帮助。
标签: javascript html css google-chrome web