2016-08-18 162 views
0

我減小了按鈕的寬度,並且想要對齊中間的圖形。中心對齊按鈕中的圖形

這裏是我的代碼:

<div class="btn-group btn-toggle"> 
<button class="btn btn-primary btn-sm" type="button" style="width:20px"> 
<span class="glyphicon glyphicon glyphicon-sort-by-alphabet"></span> 
</button> 
<button class="btn btn-default btn-sm" type="button"> 
<span class="glyphicon glyphicon glyphicon-sort-by-alphabet-alt"></span> 
</button> 
</div> 

這裏是一個bootply鏈接:http://www.bootply.com/HYU6Nff6bk#

如何能不能做到?

回答

0

該按鈕仍然使用padding-left:10px; and padding-right:10px;

如果您想要一個寬度爲20px的按鈕,則將填充左側和填充右側減少爲零。

<div class="btn-group btn-toggle"> 
<button class="btn btn-primary btn-sm" type="button" style="width:20px; padding-left: 0px; padding-right: 0px;"> 
<span class="glyphicon glyphicon glyphicon-sort-by-alphabet"></span> 
</button> 
<button class="btn btn-default btn-sm" type="button"> 
<span class="glyphicon glyphicon glyphicon-sort-by-alphabet-alt" aria-hidden="true"></span> 
</button> 
</div>