TAGS :Viewed: 13 - Published at: a few seconds ago

[ CSS styling on Simple Form in Rails Bootstrap ]

Does anyone know how to put CSS styling on labels in Simple Form with Rails Bootstrap (SCSS)?

I have this line in my form. I can't find a way to style the label.

I have a css div class defined as 'question-project', but I can't find a way to get the form to pick it up.

    <%= f.input :project_title, label: 'Project Title', placeholder: 'A catchy, relevant title for your project', :input_html => {:style=> 'width: 650px', class: 'response-project'} %>

If I put a div tag around the entire <%= %> then it overrides the styling inside the field.

Thank you

Answer 1


After a day of searching, I found the answer. I hope this helps others who don't understand how to work with these tools intuitively.

<%= f.input :project_title, label: 'Project Title', :label_html => { :class => 'question-project' }, placeholder: 'A catchy, relevant title for your project', :input_html => {:style=> 'width: 650px', class: 'response-project'} %>

^ You can see above that there is a :label_html field and an :input_html field.