2017-02-06 31 views
-2
<div class="row"> 
<div class="container"> 
    <div class="col-md-4 col-md-offset-4"> 
    <div class="login-wrapper"> 
     <div class="login-head"> 
      <h3 class="text-center"> Log in </h3> 
     </div> 

     <form> 
      <div class="form-group"> 
      <label for="email" class="sr-only"> Email </label> 
      <input type="text" placeholder="email here" class="form-control"> 
      </div> 

      <div class="form-group"> 
      <label for="email" class="sr-only"> Password </label> 
      <input type="text" placeholder="Password here" class="form-control"> 
      </div> 

      <button type="button" class="btn btn-danger center-block"> Login </button> 

     </form> 

    </div> 
    </div> 
</div> 
</div> 

此代碼後,我得到的滾動條在我的瀏覽器,所以我檢查後發現,如果我做出改變我的代碼有什麼問題?

.row { margin-right: 0;} 

它就好了。這與我的CSS無關,我刪除了我的CSS並嘗試。所以我應該通過bootstrap改變.row的值嗎?默認值是

.row{margin-right: -15px;} 

編輯:代碼的格式如下的代碼現在

+0

如果你想擺脫你滾動條又在哪裏出現滾動條只需添加CSS到容器中。例如:.container {overflow-x:hidden;或者溢出-y:隱藏; } – Luke359

+0

在'.container'類中添加'.row'類..並檢查 –

+0

只有'.col- *'應該是'.row'的直接子節點 – ZimSystem

回答

0

如引導文件中提到,container應該是一個頂級的包裝類,它應該包含row類。你已經交換了這些類。我認爲這是問題的原因。自舉引進

第一規則說:

行必須被放置爲適當對準和填充一個.container(固定寬度)或.container流體(全寬度)之內。

代碼應該是:

<div class="container"> 
<div class="row"> 
    <div class="col-md-4 col-md-offset-4"> 
    <div class="login-wrapper"> 
     <div class="login-head"> 
      <h3 class="text-center"> Log in </h3> 
     </div> 

     <form> 
      <div class="form-group"> 
      <label for="email" class="sr-only"> Email </label> 
      <input type="text" placeholder="email here" class="form-control"> 
      </div> 

      <div class="form-group"> 
      <label for="email" class="sr-only"> Password </label> 
      <input type="text" placeholder="Password here" class="form-control"> 
      </div> 

      <button type="button" class="btn btn-danger center-block"> Login </button> 

     </form> 

    </div> 
    </div> 
</div> 
</div> 
+0

謝謝我認爲我犯了這個錯誤:) –

+0

你是歡迎!如果它對你有幫助,不要忘記提高答案。 – Banzay