Question

I am writing a form with three text input fields. I have used text_field_tag to create them

<%= text_field_tag(:input_first) %>
<%= text_field_tag(:input_second) %>
<%= text_field_tag(:input_first) %>

Am using bootstrap css. I want to make the second input larger than the first and the third input. How can I achieve that?

I have tried the below, and even more and the input field size is not changing.

first

<%= text_field_tag(:input_second, :input_html => { :class => "input-large"})  %>

second

<%= text_field_tag(:input_second, nil, :class => "input-large")  %>

third

<%= text_field_tag(:input_second, nil, :size=> 30)  %>

fourth

<span class="input-large">
 <%= text_field_tag(:input_second) %>
</span>

What wrong am I doing? Am a beginner in rails/css/html ps: should I use text_field_tag or text_field ?

Was it helpful?

Solution

Bootstrap utilizes specific classes to control the width of input elements:

enter image description here

In a Rails template, you'd invoke a text_field_tag in the following manner:

<%= text_field_tag('input_second', nil, class: 'input-large') %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top