简体   繁体   English

CSS 未保存在 Live Server 中(VS CODE)

[英]CSS not saving in Live Server (VS CODE)

I started learning VS Code through Udemy and I already have one problem that I can't find answer anywhere.我开始通过 Udemy 学习 VS Code,但我已经遇到了一个在任何地方都找不到答案的问题。 In the project I have index.html, style.css and script.js.在项目中,我有 index.html、style.css 和 script.js。 Now when I try to save the html, the page reloads and everything from the html is applied, the same with javascript, but when I try to save the CSS, the page reloads but everything from the CSS is not applied to the page.现在,当我尝试保存 html 时,页面重新加载并应用了 html 中的所有内容,与 javascript 相同,但是当我尝试保存 CSS 时,页面重新加载但 CSS 中的所有内容都没有应用于页面。

How can I fix this?我怎样才能解决这个问题?

首先尝试添加内部 CSS,然后它会检查您是否将 style.css 和 js 正确链接到 index.html。如果您提供了您的 vs 代码的屏幕截图,我认为提供解决方案会更好也更容易,因为在链接到 html 时您需要正确提及文件路径。

你确定 style.css 链接到你的 index.html 吗?

Make sure that your style.css is linked correctly to your html page.确保您的 style.css 正确链接到您的 html 页面。 Then clear the cache of your browser when you reload.然后在重新加载时清除浏览器的缓存。 On chrome => ctrl + f5在 chrome 上 => ctrl + f5

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

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