Topic: Is it possible to customize text boxes with CSS ?

I want to customize the text boxes that are generated from the rails framework.
I tried something like to create a CSS class,

.text_box {
  ...code here
}

and then

<div class="text_box"><%= text_field_tag :email, params[:email] %></div>

but it doesn't seem to work!

Re: Is it possible to customize text boxes with CSS ?

you don't need to wrap it in a div, you can apply your style directly to the text field, the third argument to text_field_tag is an optional Hash of html attributes

  <%= text_field_tag :email, params[:email], :class => 'text_box' %>

http://api.rubyonrails.org/classes/Acti … ml#M001731

Re: Is it possible to customize text boxes with CSS ?

Ohh.. thank you very much!

Re: Is it possible to customize text boxes with CSS ?

The other approach to pass HTML attributes is to use

<%= text_field_tag :email, :html => {:class => 'text_box'} %>

Whichever method is easier for you really... smile

Re: Is it possible to customize text boxes with CSS ?

Yes it is possible by following way:
1. Set up the style sheet. In CSS, you must first establish that you are creating a style sheet.
2. Establish your form. The CSS language identifies forms by type of input element, such as input or textbox.
3. Select your background color and type in the appropriate information within the curly brackets.
4. Establish a border color and indicate the size of the borderline.
5. Define the font. When assigning a font, you should choose family style , a color and a letter size.
6. Add the closing tag to finish the page.