Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to give style to simple_form label?

I'm trying to change the font-size and the spacing between the input box and label, in a form I've generated with the simple_form gem, 2.0.2. I'm sure there's a way to do this?

At present I have:

<%= f.input :comment, :input_html => { :wrap => :soft, :rows => 2}, :label => 'Type in box below:', :item_wrapper_class => 'type' %>

And in my css:

    .type{
  font-size: 24px;
  margin-top: 15px;
}

I read in a post on this site that 'item_wrapper_class' would do the trick, but when I go to inspect element in Chrome, over the 'Type in box below:' part, it doesn't even pick up on the .type class, in my css - it just goes to the default label class, in bootstrap.

Any help would be appreciated, thanks.

like image 832
CHarris Avatar asked Jun 22 '13 01:06

CHarris


2 Answers

This worked for me:

<%= f.input :comment, :input_html => { :wrap => :soft, :rows => 2}, :label => 'Type in box below:', :label_html => { :class => 'type' } %>
like image 170
CHarris Avatar answered Nov 07 '22 03:11

CHarris


Have you tried something like this?

<%= f.input :comment, :input_html => { :wrap => :soft, :rows => 2}, :label => 'Type in box below:', wrapper_html: { class:  'type' } %>
like image 24
Guillermo Maschwitz Avatar answered Nov 07 '22 01:11

Guillermo Maschwitz