Bootstrap在div中垂直居中文本 [英] Bootstrap vertically center text in div

查看:62
本文介绍了Bootstrap在div中垂直居中文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 div 中的文本垂直居中,但无法正常工作.

代码:

<h3><i class="fa fa-cloud fa fa-3x"></i>文本

有没有人有解决方案?我尝试了很多可能性,但似乎都不起作用.

解决方案

我建议 vertical-align: middle 应用您的图标字形.例如:

h3 .fa {垂直对齐:中间;}

http://jsfiddle.net/22cYh/

I'm trying to vertically center text in a div, but I can't get it working.

The code:

<div>
    <h3><i class="fa fa-cloud fa fa-3x"></i> Text</h3>
</div>

Does anyone have a solution for this? I tried many possibilities but none of them seem to work.

解决方案

I would suggest vertical-align: middle applied your icon glyph. For example:

h3 .fa {
    vertical-align: middle;
}

http://jsfiddle.net/22cYh/

这篇关于Bootstrap在div中垂直居中文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆