Following is _form.html.erb generated during scaffolding.
<%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<!-- <div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>-->
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
I want to use the same view, but I want to apply style to it. I can see div classes “field” and “action”, but I cannot apply style to it. I tried applying style from assets/stylesheets/posts.css. Neither can I find where css is originally applied to this form.
I am sorry, I am new to rails. Any help is appreciated. Thanks.
Normally, you should have a css layout file at this path :
which is called from the main application layout :
In that file, you should see the following line :
That instruction calls the
_stylesheets.html.erblayout file. In that file, you can find all the css imports. Ex :If you want reach the
styles.cssfile, you can find it here :