我的网页忽略CSS文件的更改 [英] My webpage ignores changes in CSS file

查看:78
本文介绍了我的网页忽略CSS文件的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论我的.css文件中有什么变化,页面保持不变 - 更重要的是,既不改变链接标签,以便它指向另一个.css文件也不删除它完全没有区别。应用了html代码中的其他更改。网页的源代码显示一切,因为它应该是。当我将链接标记从前一个文件重定向到我现在使用的链接标记时,此行为开始(加上标记中发生了一些更改,以测试我的网页的行为)。两个文件中的更改都不会影响页面。

No matter what I change in my .css file, the page remains the same - what's more, neither changing the link tag so that it points to another .css file nor deleting it completely makes no difference. Other changes in html code are applied. The sourcecode of the webpage shows everything as it should be. This behavior started when I redirected the link tag from previous file to the one I use now (plus there have been some changes in the tag while this problem occured, to test the behavior of my webpage); changes in neither file affect the page.

这是发生这种情况的第一次,这是由于代码的头部标签的副本等等 - 它们的头部覆盖了主页的头部),并且通过从这些文件中去除这些冗余头来解决问题。但它发生了,当我改变了下一次的链接标签。我在我的包含的文件中找不到任何头部,但问题持续(只有解决方案我现在可以看到是删除包含的文件,并将代码直接复制到文件,但这将意味着大量的冗余代码)。

For the first time when this happened, this was caused by copies of head tag in included chunks of code (for header, left menu etc. - their head part overrode the head part of the main page) and the problem was solved by removing these redundant heads from these files. But it happened again when I changed the link tag for the next time. I couldn't find any head parts in my included files, but the problem lasts (only solution I can see now is to delete the included files and copy the code directly to the file, but this would mean lots of redundant code).

我如何解决这个问题,以便我的页面响应.css文件中的更改,而不增加冗余?如何确保我可以更改的链接到.css文件只是在一个地方没有这样的问题?

我必须以某种方式载入CSS文件?

Do I have to unload the CSS file somehow?

我在Firefox和Chrome中都看到了这个问题。我使用PSPad编写代码,以防万一它会发挥作用。

I saw this problem both in Firefox and in Chrome. I use PSPad to write the code, just in case it would play role.

编辑:我已经清除浏览器缓存,我改变了链接到.css文件一个到另一个之前,但没有什么帮助。现在我接受最好的答案,说这个问题是在缓存,我开始一个相关问题,以了解如何解决缓存问题。如果另一个问题的答案会说,在这种情况下,我可以确定问题不是在缓存(不太可能,但是失败的普通缓存方法 - 问题解决不太可能),我会更新这个问题,并开始搜索其他可能的问题,但现在的信息似乎是清楚的:当网页忽略.css文件的变化,缓存是怪的

I have cleared browser cache now, and I changed the link to .css files from one to another before, but nothing helped. Now I accept the best answer saying the problem is in caching and I start a related question to find out how to solve the caching issue. If the other question's answers would say that in this case I can be sure that problem isn't in caching (very unlikely, but fail of ordinary methods of caching-problems-solving is unlikely too), I'd update this question and start searching for other possible problems, but now the message seems to be clear: when webpage ignores changes in .css files, caching is to blame.

EDIT2:这个问题是一个错误的结果,我的问题的解决方案是在别的地方,但有很多问题与这一个在书写这里stackoverflow,所以我添加一个简短列表为那些真正有缓存问题(这个问题在它的存在的第一天被查看了足够的时间,以便它可能会值得):

This question is sort of a result of a mistake and the solution of my problems is somewhere else, but there are many questions related to this one as written here on stackoverflow, so I add a brief list for those who really have a problem with caching (this question was viewed enough times in the first day of its existence so that it might do worth it):

样式表未更新

Firefox浏览器不会重新加载更新的CSS / JS文件

强制浏览器重新加载缓存的CSS / JS文件是什么?

确保所有浏览器的网页都不会缓存

最后,一个来自超级用户:

And, finally, one from super user:

配置xampp从不缓存来自localhost的页面

推荐答案

解决了,它不是关于缓存!

Solved, and it wasn't about caching! I thought .css files are to blame, but the mistake was between chair and keybord.

我的html / php代码的主体看起来像这样:

The body of my html/php code looked like this:

<body>

<?php
  include 'header.php';
  include 'left_menu.php';
  include 'footer.php';
?>

*main page code*

</body>

我的页脚和主页都在左侧菜单中移动这个问题,但我知道如何解决它现在)。我错误地指责一些错误在.css文件这个,所以我问这个问题。如果我有例如。改变背景颜色或做一些其他变化清楚可见的微小的空间留给我的主页,很明显,.css文件更新正常,问题是别的地方。

My footer and main page were all moved inside the left menu (I don't know what exactly caused this problem, but I know how to solve it now). I mistakenly blamed some error in .css file of this, so I asked this question. If I had e.g. changed the background color or made some other change clearly visible on the tiny space left for my main page, it would become clear that the .css file updates normally and problem is somewhere else.

我刚更改了include标签的位置,一切正常:

I just changed the position of include tags and everything is OK:

<body>

*main page code*

<?php
  include 'header.php';
  include 'footer.php';
  include 'left_menu.php';
?>

</body>

对不起,问我要不要我真正想要的东西,感谢教我如何解决缓存问题(我几乎肯定我会在未来的某一天面对他们)。

Sorry for asking you for something else than I really wanted, and thanks for teaching me how to solve caching problems (I'm almost sure I'll face them some day in the future).

这篇关于我的网页忽略CSS文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆