Twitter Bootstrap - 如何水平或垂直居中元素 [英] Twitter Bootstrap - how to center elements horizontally or vertically
本文介绍了Twitter Bootstrap - 如何水平或垂直居中元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在主父元素内垂直或水平居中 html 元素?
is there any way to center html elements vertically or horizontally inside the main parents?
推荐答案
更新:虽然这个答案在 2013 年初可能是正确的,但不应再使用.正确的解决方案使用偏移量,如下所示:
Update: while this answer was likely correct back in early 2013, it should not be used anymore. The proper solution uses offsets, like so:
class="mx-auto"
至于其他用户的建议,也有可用的本机引导程序类,例如:
As for other users suggestion there are also native bootstrap classes available like:
class="text-center"
class="pagination-centered"
感谢@Henning 和@trejder
thanks to @Henning and @trejder
这篇关于Twitter Bootstrap - 如何水平或垂直居中元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文