Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails form_for styling

Tags:

Is there a way to add styling to rails form_for and make it display inline?

like image 536
Daniel Avatar asked Sep 01 '09 03:09

Daniel


2 Answers

There might be a cleaner way to do this, but it works. (I tried with another nested hash, no dice)

 <% form_for(@model, :html => { :style => 'background-color:red;' }) do |f| %> 
like image 88
Andy Gaskell Avatar answered Oct 04 '22 20:10

Andy Gaskell


A even cleaner way would be to define the styling in an external stylesheet (like application.css). form_for creates a <form id="something"/> tag with an id attribute. You can of course use this id in your stylesheet(s) to apply some specific styling to the form.

like image 41
Christoph Schiessl Avatar answered Oct 04 '22 18:10

Christoph Schiessl