2016-03-25 125 views
0

Not center引導中心的形式和形式

<div class="row"> 
    <div class="col-md-4"> 

    </div> 
    <div class="col-md-4">  
     <div class="center-block text-center"> 
      <form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form"> 
       <div asp-validation-summary="ValidationSummary.All" class="text-danger"></div> 
       <div class="form-group"> 
        <div class="col-md-10"> 
         <input asp-for="Email" placeholder="Email" class="form-control" /> 
         <span asp-validation-for="Email" class="text-danger"></span> 
        </div> 
       </div> 
       <div class="form-group"> 
        <div class="col-md-10"> 
         <input asp-for="Password" placeholder="Password" class="form-control" /> 
         <span asp-validation-for="Password" class="text-danger"></span> 
        </div> 
       </div> 
       <div class="form-group"> 
        <div class="col-md-10"> 
         <button type="submit" class="btn btn-block">Sign in</button> 
        </div> 
       </div> 
      </form>   
      <p> 
       <a asp-controller="Home" asp-action="Register">Sign up</a> 
      </p> 
      <p> 
       <a asp-action="ForgotPassword">Forgot your password?</a> 
      </p> 
      <p> 
       <a asp-controller="Home" asp-action="Index">Return</a> 
      </p>   
     </div> 
    </div> 
    <div class="col-md-4"> 

    </div> 
</div> 

回答

1

文本居中下一些文字,但形式具有寬度10/12(83%)。您應該將col-md-10更改爲col-md-12

<div class="form-group"> 
    <div class="col-md-12"> 
     <input asp-for="Email" placeholder="Email" class="form-control" /> 
     <span asp-validation-for="Email" class="text-danger"></span> 
    </div> 
</div> 
<div class="form-group"> 
    <div class="col-md-12"> 
     <input asp-for="Password" placeholder="Password" class="form-control" /> 
     <span asp-validation-for="Password" class="text-danger"></span> 
    </div> 
</div> 
<div class="form-group"> 
    <div class="col-md-12"> 
     <button type="submit" class="btn btn-block">Sign in</button> 
    </div> 
</div> 
+0

哦!看起來我忘了改變這些。亞,或者只是不使用任何類。 –

0

我認爲,這將是最好的去除col-md-10類:

<div class="form-group"> 
    <div class=""> 
     <input asp-for="Email" placeholder="Email" class="form-control" /> 
     <span asp-validation-for="Email" class="text-danger"></span> 
    </div> 
</div> 
<div class="form-group"> 
    <div class=""> 
     <input asp-for="Password" placeholder="Password" class="form-control" /> 
     <span asp-validation-for="Password" class="text-danger"></span> 
    </div> 
</div> 
<div class="form-group"> 
    <div class=""> 
     <button type="submit" class="btn btn-block">Sign in</button> 
    </div> 
</div>