html - CSS 更改未得到反射(reflect)。为什么?

标签 html css

<分区>

我在我的网站上工作,每当我向我的 CSS 文件添加一些新行时,它就是不想使用我创建的行。

但是,他们应该没问题。

.what-new {
    padding:2em 0 4em;
    text-align:center;
}
.what-new h3 {
    font-size:4em;
    font-weight:700;
    color:#000;
    margin:0.5em 0;

举个例子。

CSS 文件在某一部分工作,但从某处它只是停止使用我的文件。 然而,它在 <head> 中链接。

<link rel="stylesheet" href="style/css_2-play.css" type="text/css"/>

而我的 HTML 代码如下(注意这只是代码的一部分):

    <div class="what-new">
    <div class="container">
        <h3>What's new</h3>
        <div class="blog-news">
            <div class="blog-news-grid">
                <div class="news-grid-left">
                    <h4>06</h4>
                    <small>of january 2015</small>
    </div>

有人知道解决方案吗?

最佳答案

这意味着您的CSS 规则未应用,或者您的CSS 文件已缓存

可能的原因是:

  • a CSS rule with a higher Specificity is winning over the rule you expect to be applied
  • a CSS rule with the same Specificity is loaded after your
    (the order of declaration counts - the latter wins - so check your CSS file imports)
  • a CSS rule targeting your object uses the !important keyword.

通过浏览器的开发人员工具(使用 F12 打开)检查规则的应用方式

提示:在 CSS 面板中,规则按重要性降序排列。

  • your CSS has syntax errors
  • your HTML is not well-formed

使用一些验证器

  • your browser is caching the CSS file

通过按 CTRLF5 强制刷新浏览器缓存的资源

提示: This Q&A探索这个主题。

  • your server is caching the CSS file

通过在地址栏中输入静态资源的 URL 并按 CTRLF5 来强制刷新服务器缓存资源 that 页面(即 CSS 文件)。

提示:要快速打开 CSS 文件的 URL,请使用浏览器开发人员工具中的在新标签页中打开链接,或单击打开的 HTML 中的 CSS 链接使用查看源代码

关于html - CSS 更改未得到反射(reflect)。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28235731/

相关文章:

jQueryUI 对表列的影响

javascript - target 属性的 CSS 版本

html - parent 的填充与 child 的边距

php - 不断更新 php 查询

javascript - 如何修复 Accordion 拼贴菜单的 Tab 键顺序?

html - 只使用css transform translate来控制动画而不是margin等非优化

html - 如何让div断线?

jquery - div的图像叠加

jquery - 在没有 &lt;input type ="number"> 的情况下在移动设备上调出小键盘

html - 如何使用边框分隔表格中的行