twitter bootstrap - Rails link_to tag tag with styled glyphicon -


i trying use glyph icons have styled in rails app.

i want make icon link page, can't use standard bootstrap styling because have customised links page's style.

i keep getting keyword class error - know why?

thank you.

i have following link in view:

<li><%= link_to <span class="glyphicon glyphicon-comment"></span>, page_path('messages') %> </li> 

i have css follows:

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;}; } 

you have use " around string, need call html_safe method on it.

<%= link_to "<span class=\"glyphicon glyphicon-comment\"></span>".html_safe, page_path('messages') %> 

but better , cleaner way be

<%= link_to page_path('messages') %>   <span class="glyphicon glyphicon-comment"></span> <% end %> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -