我的CSS不变,为什么? [英] My CSS doesn't change, why?
问题描述
所以几周后,我回到编码上,遇到了一个问题.
So after many weeks, I got back to coding and I've got a problem.
我正在从事的项目包含PHP网站的基本内容,现在我正尝试重新设计主页.
The project I was working on contains the basic stuff of a PHP site and now I'm trying to re-design my homepage.
问题是,每当我删除或更改CSS中的某些内容时,设计就永远不会像冻结或其他内容一样进行更改,并且它会在每个页面中发生.当我删除HTML中CSS的链接时,设计就消失了.这是代码:
The problem is, that everytime I delete or change something in the CSS, the design never changes as if it's like frozen or something, and it happens for every page. When I delete the link to the CSS in my HTML, the design goes away. Here's the code:
var scrolled=0;
$(document).ready(function() {
$("#master").click(function() {
$("#holder").slideToggle('slow');
});
$("#down").on("click" ,function() {
scrolled=scrolled+300;
$("#solut").animate({
scrollTop: scrolled
});
});
});
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
body {
margin: 0;
padding: 0;
background-color: #e0e0e0;
overflow-x: hidden;
}
.navbar {
width: 100%;
height: 60px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="assets/logo.png" />
<link href="css/font-awesome.min.css" rel="stylesheet" />
</head>
<body>
<center>
//code goes here: bunch of divs and texts
</center>
</body>
</html>
推荐答案
不使用简短的使用指南,自述文件或<在运行和测试网站时,strong>自动化任务的基本列表可能会导致一些不良的副作用.
Getting back to an old project without a short run-through-guide, readme or a basic list of automated tasks can lead to several, unwanted side effects, when running and testing the website.
这是我从头顶见过的一些东西:
Here are some of what I've met before from the top of my head:
-
浏览器缓存::在Chrome中打开DevTools,然后通过点击空缓存和硬重载 (Ctrl + Shift + F5).如果没有帮助,请为您的CSS命名,例如:( 有关缓存突发的更多信息 ):
<link href="css/index.css?v=1.0.1" rel="stylesheet" />
Browser cache: Open DevTools in Chrome, then reload the page by clicking Empty Cache and Hard Reload (Ctrl+Shift+F5). If it doesn't help, give your CSS a name like: (more on cache-bursting):
<link href="css/index.css?v=1.0.1" rel="stylesheet" />
框架缓存::如果您将框架与资源缓存一起使用,请删除/清空该框架.这取决于您使用的框架(如果有).
Framework cache: If you use a framework with resource caching, delete/empty it. It depends on what framework you use, if any.
CSS Transpiler无法运行::如果您使用某些Transpiler( SASS , LESS 等),有时会忘记运行转换.
CSS Transpiler does not run: If you use some transpiler (SASS, LESS, etc.), sometimes running of the transpilation is forgotten.
在移动设备上进行测试:他们可以并且经常进行缓存,只是在开发过程中使用缓存爆发.
Testing on mobile devices: They can and do cache often, just use cache-bursting during development.
Wrong paths/inability to access files: Check your webserver logs to get what's wrong.
Not REALLY editing the file: If you prefer an IDE (e.g.: IntelliJ IDEA ;)) and when you edit the specific file, save it, then upload it (e.g.: via FTP), it can happen, that the specific file won't get updated. More on this.
这篇关于我的CSS不变,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!