2012-11-01 65 views
0

感謝您的時間!導軌視圖link_to

我有一個代碼:

<link href="/stylesheets/show.css" media="screen" rel="stylesheet" type="text/css"> 

<div id="body-container"> 
     <div id="left-column"> 
       <ul id="report-list"> 
         <% for report in @reports %> 
          <li><%= link_to(report, {:controller => 'loadreport', 
                 :action => 'get_report_content', 
                 :test_name => report})%></li> 
         <% end %> 
       </ul> 
     </div> 
     <div id="right-column"> 

    </div> 
</div> 

link_to方法會產生這樣的HTML標籤:

<a href="/loadreport/get_report_content?name=Test1">Test1</a> 

我想就tag a一些裝飾。因此,在CSS文件中,我得到這個代碼:

a:link { text-decoration: none;} 

a:hover {text-decoration-color: #adff2f;} 

它沒有這些裝飾添加到tag a。我認爲這是因爲tag a是由rails link_to方法生成的。我們沒有提前tag a。我對嗎?那我怎麼能做到這一點?

+0

你是不正確的,必須有別的東西。所有的瀏覽器都是HTML + CSS。 –

回答

5

你可以試試這個:

a { text-decoration: none; } 
a:hover { color: #adff2f; } 
+0

感謝您的回答。有用。我剛剛發現我把CSS代碼放在錯誤的CSS文件中。所以我的假設是完全錯誤的。 – mCY

+0

感謝您的接受!) – Thanh