Reputation: 15374
Is it possible to use font awesome icons within a label when creating a form for example.
if my form looks like this
<%= f.label :email %>
<%= f.email_field :email, :autofocus => true %>
How would i add the i class to the label?
I have tried this
<%= f.label :email, :class => 'icon-user' %>
<%= f.email_field :email, :autofocus => true %>
but this doesn't work?
Upvotes: 4
Views: 2816
Reputation: 4603
Try something like this (assuming email
is a field of class User
):
<%= f.label :email do %>
<i class="icon-user"></i>
<%= User.human_attribute_name :email %>
<%- end -%>
Upvotes: 5