2016-02-13 91 views
0

我在我的ROR應用程序中有以下haml文件,我嘗試通過#index_orders下的文本部分實現通過CSS的排版和字體更改。但是,當我在下面實現了這些更改時,特別是在CSS文件中,刷新我的開發環境(localhost:3000)時沒有任何效果。已更新的CSS文件的更改不生效

這裏是下面用適當的嵌套和間距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 

現在,這裏是應用程序的選定部分帶有相關代碼的CSS文件:

application.css.scss

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

爲什麼字體顏色/版式更改不生效?

非常感謝!

+0

你有沒有試過清除瀏覽器緩存? – Barmar

回答

1

樣式規則僅針對h2元素。由於index.html.haml中沒有h2元素,因此不會看到預期的視覺變化。

,查看應用的式樣規則,改變h2選擇在application.css.scss靶向期望h1h3元件。

例如,

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