简体   繁体   English

对更新的CSS文件所做的更改未生效

[英]Changes to updated CSS file do not take effect

I have the following haml file in my ROR application, which I am trying to implement typography and font changes to via CSS for the portion of text under #index_orders . 我的ROR应用程序中有以下haml文件,我正在尝试通过CSS对#index_orders下的部分文本进行排版和字体更改。 However, when I've implemented the changes below, specifcally in the CSS file, nothing is taking effect when I refresh my development environment (localhost:3000). 但是,当我在CSS文件中具体实现了以下更改时,刷新开发环境(localhost:3000)时没有任何效果。

Here is the haml file below with the appropriate nesting and spacing included: 这是下面的haml文件,其中包含适当的嵌套和间距:

index.html.haml index.html.haml

<div class="jumbotron">
%h1 <center><font color ="#c0392b"><i>Hello World!</i></font>
<center>
%br/
%h3 Some Generic Message, Woot! :)
%br/
<a class="btn btn-danger btn-lg" href="#" role="button">Sign Up</a>

#index_orders
  - @orders.each do |order|
      %h3= link_to order.date.strftime("%A %B %d, %Y"), order
      %h4= order.name

Now here is the select portion of the application CSS file with the relevant code: 现在这是带有相关代码的应用程序CSS文件的select部分:

application.css.scss application.css.scss

#index_orders {
    h2 {
        margin-bottom: 0;
        font-weight: 100;
            a {
               color: white;
            }
        }
    }

Why aren't the font color/typography changes taking effect? 为什么字体颜色/印刷字体更改没有生效?

Many thanks! 非常感谢!

The styling rule is only targeting the h2 element. 样式规则仅针对h2元素。 As there is not an h2 element in your index.html.haml, you will not see the anticipated visual changes. 由于index.html.haml中没有h2元素,因此您将看不到预期的视觉变化。

To see the styling rule applied, change the h2 selector in application.css.scss to target the desired h1 or h3 element. 要查看应用的样式规则,请更改application.css.scss中的h2选择器以定位所需的h1h3元素。

For example, 例如,

#index_orders {
    h3 {
        margin-bottom: 0;
        font-weight: 100;
            a {
               color: white;
            }
        }
    }

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

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