2016-10-18 32 views
0

我的頁面上有兩個輸入元素。我需要在這兩個元素之間留出餘地。如何在bootstrap中的輸入標籤之間設置頁邊距?

<input type="text" class="form-control" placeholder="Username"> 
<input type="password" class="form-control" placeholder="password"> 

我已經創建了一個類來爲密碼輸入分配餘量。我想知道是否有更好的方法來做到這一點?也許通過用div包裝兩個輸入標籤?

+0

我沒有看到毛邊方式的問題 – j08691

回答

0

您可以使用此代碼:如果您使用的引導

.form-control { 
    margin:0 5px; // for left and right margin 
    margin:5px 0; // form top and bottom margin 
} 
1

,正確的辦法是做這樣說:如果你在他們之間加空格只是感興趣

<div class="form-group"> 
    <input type="text" class="form-control" id="Username" placeholder="Username"> 
</div> 
<div class="form-group"> 
    <input type="password" class="form-control" id="Password" placeholder="Password"> 
</div> 

,在這裏你去:

.space-right { 
 
    margin-right: 10px; 
 
}
<input type="text" class="form-control space-right" placeholder="Username" /> 
 
<input type="password" class="form-control" placeholder="password" />

相關問題