这个问题在这里已有答案:
在一个bootstrap响应页面中如何将div 9个答案 集中在一起在bootstrap .pull-right中用于右对齐.pull-left用于左对齐然后什么用于中心?
This question already has an answer here:
In a bootstrap responsive page how to center a div 12 answersIn bootstrap .pull-right for align right .pull-left for align left then What for center ?
最满意答案
Bootstrap的.pull-left和.pull-right使用css-float工作。
float的工作方式是在浮动元素周围流动跟随内联元素。
css-float support: left , right , none 。 没有中心选择。 因此,没有.pull-center 。
通过将css: text-align: center应用于父元素,可以对齐块元素中的所有内联元素。
如果元素是你试图居中应该是内联和块状,你应该将它设置为display: inline-block 。
你可以在bootstrap中看到一些文本对齐选项: http : //getbootstrap.com/css/#type-alignment注意<p>是一个块类型元素,其中的文本有一个隐含的文本节点display: inline 。
center-block类只能用于图像: http : //getbootstrap.com/css/#images
Bootstrap's .pull-left and .pull-right, work using css-float.
The way float works is by flowing following inline elements around the floated element.
css-float support: left, right, none. There is no center option. Therefore, there is no .pull-center.
You can align all inline elements within a block element by applying the css: text-align: center to the parent.
If the element is you're trying to center should be inline AND block-like, you should set it to have display: inline-block.
You can see some text-alignment options in bootstrap here: http://getbootstrap.com/css/#type-alignment Note that the <p> is a block-type element, and the text within has an implicit text-node which is display: inline.
The center-block class can only be used on images: http://getbootstrap.com/css/#images
更多推荐
发布评论