Reputation: 6493
I am new to Rails so this is probably an easy question but can't find anything that seems to explain it well.
How do I style forms in rails to. When I try to use the default styling for input (for example) it styles my text field and create button the same. Is there a built in convention or do I have to add some sort of helper. If it is a helper can you you walk me through that as I have not done it before.
Here is my form:
<% form_for (Post.new) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :BattleCry %>
<br/><i>Between 25 and 300 words</i><br/>
<%= f.text_area :body %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %><hr/>
Upvotes: 2
Views: 2518
Reputation: 30432
The most appropriate way would likely be just giving them different classes and styling them via usual css methods.
Eg.
<%= text_field( :title, :class => "something" ) %>
Upvotes: 6
Reputation: 3360
I think this is more of a CSS question. You seem to be on the right track ruby-on-rails-wise. Both text field and button are of type input in html, that's why your CSS style applied to both.
Upvotes: 0