Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Form Spacing

I was playing around with my sign in form and it seems that everything is scrunched up. I had it fixed but literally didn't change anything and it randomly broke, my code can be found below.

Code:

<div class="container">
  <div class="row">
    <div class="col-md-4 well sign_in">
      <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>

      <fieldset>
        <legend>Sign In</legend>

      <%= f.input :email, :class => "form_margin_fix" %>
      <%= f.input :password, :class => "form_margin_fix"%>

      <% if devise_mapping.rememberable? -%>
      <div><%= f.input :remember_me, as: :boolean %> </div>
      <% end -%>

      <div><%= f.submit "Sign In", :class => 'sign_in_button' %></div>
    </fieldset>
      <% end %>

      <%= render "devise/shared/links" %>
    </div>
    <div class="col-md-8">
      <h2>Signing in is easy and secure</h2>
    </div>
  </div>
</div>

Would need to See the CSS for the form too.

See that's the thing it's extremely simple CSS an at first it was working, then I applied the same class to a f.input on another page and it didn't work on it and now no css styling will work on any page. However he was my css below.

.form_margin_fix {
    margin-bottom: 10px;
}

If you remove the class you added to the input before it broke. Does it work again?

The input fields themselves aren't actually broken everything functions on a back-end level but no now it won't style at all, I have tried renaming the class etc. I also have f.submit styled as well and it works fine it's just the damn form that wont.

However I should mention this is done in the application.css file that is generated with rails

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Try double checking to make sure that style is not being overridden some place else. Perhaps in another css file?

It was, I'm honestly not sure what was causing it in the beginning but I remember it quit working so I was told to run a command to populate the Public directory in my app, and I remembered doing this so I deleted all the files in that directory and it started working again.