Why is my form overlapping my h2 element using Ruby on Rails?

27 views Asked by At

I am very new to rails, and am practicing making a movie watchlist app. I have installed the simple_form gem and generated it to be used with bootstrap. In my new.html.erb, I am wanting to add a form where users can add a new movie to the list. However, for some reason my form is fixed to the top of my display page underneath my h2 tag, and I cannot seem to move it down no matter how much margin top and bottom I apply.

Does anyone have an idea on what might fix this issue? I have also used a simple_form_for on my edit.html.erb and I have had no issues with that page so I don't know why it is only going wrong here (hopefully just overlooking something minor!)

Here is my code on new.html.erb :

<div class="mb-3">
  <h2>Add a new movie</h2>
</div>

<div class="mt-3">
  <%= simple_form_for(@movie) do |f| %>
    <%= f.input :title, input_html: { class:'form-control form-control-sm m-3 w-25' }, label_html: { class:'m-3' }, placeholder: "Shutter Island" %>
    <%= f.input :rating, input_html: { class:'form-control form-control-sm m-3 w-25' }, label_html: { class:'m-3' }, placeholder: "7" %>
    <%= f.submit class:"btn btn-primary mb-3" %>
  <% end %>
</div>

<%= link_to "Go back to watchlist", root_path, class:"btn btn-primary" %>
0

There are 0 answers