2017-05-05 96 views
0

嗨,我想在我的按鈕適用拉正確的,但我注意到兩兩件事:緣和右拉在引導按鈕

1 - 取消按鈕設在左側,但它不是,我的HTML使其處於左側,但在應用拉右後,取消按鈕在保存之後進行。

2-這是一種使用只是boostrap給按鈕之間的保證金的方法?現在按鈕沒有餘量。

.col-md-12 { 
 
    background: gray; 
 
    border: 1px solid black; 
 
    height: 50px; 
 
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 
 
<footer class="col-md-12"> 
 
    <button class="btn btn-default pull-right" data-dismiss="modal" id="btn-cancel2" type="button">Cancel</button> 
 
    <button class="btn btn-primary pull-right" data-dismiss="modal" id="btn-save2" type="button">Save</button> 
 
</footer>

回答

1

引導按鈕inline-block元素,你可以簡單地使用text-right於母公司轉移按鈕。

.col-md-12 { 
 
    background: gray; 
 
    border: 1px solid black; 
 
    height: 50px; 
 
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 
 
<footer class="col-md-12 text-right"> 
 
    <button class="btn btn-default" data-dismiss="modal" id="btn-cancel2" type="button">Cancel</button> 
 
    <button class="btn btn-primary" data-dismiss="modal" id="btn-save2" type="button">Save</button> 
 
</footer>

2

給你:

.col-md-12 { 
 
    background: gray; 
 
    border: 1px solid black; 
 
    height: 55px; 
 
    padding-top: 9px; /*Visual improvement ;)*/ 
 
} 
 

 
#btn-save2 {margin-left: 10px }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> 
 
<footer class="col-md-12"> 
 
    <button class="btn btn-primary pull-right" data-dismiss="modal" id="btn-save2" type="button">Save</button> 
 
    <button class="btn btn-default pull-right" data-dismiss="modal" id="btn-cancel2" type="button">Cancel</button> 
 
</footer>

1

上的按鈕進行

添加刪除classpull-rightClassparenttext-right

<footer class="col-md-12 text-right"> 
<button class="btn btn-default" data-dismiss="modal" id="btn-cancel2" type="button">Cancel</button> 
<button class="btn btn-primary" data-dismiss="modal" id="btn-save2" type="button">Save</button> 
</footer> 

https://jsfiddle.net/wuuf5g87/6/

1
<footer class="col-md-12 "> 

<div class="pull-right"> 


    <a class="btn navbar-btn btn-primary " href="#" target="_texturepack">Save</a> 
    <a class="btn navbar-btn btn-default" href="#" target="_texturepack">Cancel</a> 

</div> 
</footer> 

的jsfiddle Working Demo

0

.col-md-12 { 
 
    background: gray; 
 
    border: 1px solid black; 
 
    height: 50px; 
 
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 
 
<footer class="col-md-12"> 
 
    <div style="float:right;"> 
 
    <button class="btn btn-default" data-dismiss="modal" id="btn-cancel2" type="button">Cancel</button> 
 
    <button class="btn btn-primary" data-dismiss="modal" id="btn-save2" type="button">Save</button> 
 
</div> 
 
</footer>