在动态生成的按钮中垂直对齐fa-icon

时间:2015-03-23 05:50:18

标签: jquery html css

我使用jquery动态生成一个按钮并在其中添加一个fa-icon,我需要垂直对齐该图标,因为该按钮包含两行字符串。代码:

$('#divContent').after('<center><button type="button" id="btnFiltersSave1" class="btn bg-green btn-sm"><i class="fa fa-2x fa-refresh"></i>&nbsp;&nbsp;No Filter added to this category<br/>Sync with Feature?</button></center>');

生成的按钮如下所示:

enter image description here

我希望它看起来像这样:

enter image description here

我该怎么做?有可能吗?

1 个答案:

答案 0 :(得分:0)

的CSS:

div{
   position: absolute;
   top: 15px;/**or requried**/
}

并添加父div位置相对