Mel*_*Mel 5 ruby-on-rails twitter-bootstrap glyphicons
我正在尝试使用我在rails应用程序中设置样式的字形图标.
我想让图标成为另一个页面的链接,但不能使用标准的引导程序样式,因为我已经为我的页面样式定制了链接.
我一直收到关键字类错误 - 有谁知道为什么?
谢谢.
我的观点中有以下链接:
<li><%= link_to <span class="glyphicon glyphicon-comment"></span>, page_path('messages') %> </li>
Run Code Online (Sandbox Code Playgroud)
我也有css如下:
span.glyphicon-comment {
vertical-align:middle;
margin:auto;
padding:10px;
font-size: 2em;
text-align: right;
a:link {text-decoration:none; background-color:transparent; color:grey;};
a:visited {text-decoration:none;background-color:transparent; color:grey;};
a:hover {text-decoration:none;background-color:transparent; color:dark grey;};
a:active {text-decoration:none;background-color:transparent; color:grey;};
}
Run Code Online (Sandbox Code Playgroud)
Eye*_*dic 12
你必须使用"围绕字符串,还需要调用html_safe方法.
<%= link_to "<span class=\"glyphicon glyphicon-comment\"></span>".html_safe, page_path('messages') %>
Run Code Online (Sandbox Code Playgroud)
但是更好更清洁的方式
<%= link_to page_path('messages') do %>
<span class="glyphicon glyphicon-comment"></span>
<% end %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3357 次 |
| 最近记录: |