Reputation: 2436
I am trying to create a btn (using css) that will have both an image and a text. I have the following code that works without the class, but when I am adding the class my code breaks. Is there a way to combine all of the above in link_to?
<%= link_to new_task_path do %>
<%= image_tag("new.png"), :class => 'btn btn-info' %> New Task
<% end %>
Upvotes: 0
Views: 285
Reputation: 2436
Solved with
<%= link_to image_tag("new.png") + "New Task" , new_task_path , :class => 'icon btn' %>
Upvotes: 1
Reputation: 127
add the class on tag(anchor tag)
<%= link_to new_task_path, :class => 'btn btn-info' do %>
<%= image_tag("new.png") %> New Task
<% end %>
Upvotes: 0