为什么密码确认不会留在div内?

Spe*_*ley 1 css ruby ruby-on-rails ruby-on-rails-3

我试图将一个表单包装在一个div中,而div中唯一看起来像是电子邮件和密码表单字段.密码确认就像它不在div内部.

这是观点.我在正确的目录中有一个名为_sign_up_form.html.erb的部分名称.

<div id="sign_up_form"> 
<%= render 'sign_up_form'%>
</div><!--end of the sign_up_form-->
Run Code Online (Sandbox Code Playgroud)

这是部分的

    <%= form_for(@user) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :email %><br />
    <%= f.text_field :email, :size => 40 %>
  </div>
  <div class="field">
    <%= f.label :password %><br />
    <%= f.password_field :password, :size => 40 %>
  </div>

  </div>
  <div class="field">
    <%= f.label :confirmation %><br />
    <%= f.password_field :password_confirmation, :size => 40 %>
  </div>

  <div class="actions">
    <%= f.submit 'Sign up', :controller => 'users' , :action => 'post'%>
  </div> 

<% end %>
Run Code Online (Sandbox Code Playgroud)

我试图通过这样做来改变表单的位置:

#sign_up_form{
    position:relative;
    left:400px;
    background-color:green;
}
Run Code Online (Sandbox Code Playgroud)

表单中唯一变为绿色和移动的部分是电子邮件和密码字段.密码确认和提交按钮保持在同一位置,背景不会变为绿色.为什么会这样?

sma*_*thy 10

</div>密码和密码确认字段之间有一个额外的 - 这是关闭sign_up_formdiv.