twitter-bootstrap 在引导程序中 .pull-right 右对齐 .pull-left 左对齐 那么居中呢?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39388243/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In bootstrap .pull-right for align right .pull-left for align left then What for center?
提问by Munasir Pv
In bootstrap .pull-right for align right .pull-left for align left then What for center ?
在 bootstrap 中 .pull-right 用于右对齐 .pull-left 用于左对齐然后什么用于 center ?
采纳答案by Norbert
Bootstrap's .pull-leftand .pull-right, work using css-float.
Bootstrap 的.pull-leftand .pull-right,使用 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.
css-float 支持:left, right, none. 没有中心选项。因此,没有.pull-center.
You can align all inline elements within a block element by applying the css: text-align: centerto the parent.
您可以通过将 css:text-align: center应用于父元素来对齐块元素中的所有内联元素。
If the element is you're trying to center should be inline AND block-like, you should set it to have display: inline-block.
如果您想要居中的元素应该是内联和块状的,您应该将其设置为具有display: inline-block.
You can see some text-alignment options in bootstrap here:
http://getbootstrap.com/css/#type-alignmentNote that the <p>is a block-type element, and the text within has an implicit text-node which is display: inline.
您可以在此处的引导程序中看到一些文本对齐选项:http:
//getbootstrap.com/css/#type-alignment请注意,这<p>是一个块类型元素,其中的文本具有一个隐式文本节点,即display: inline.
The center-blockclass can only be used on images:
http://getbootstrap.com/css/#images
本center-block类只能在影像中使用:
http://getbootstrap.com/css/#images
回答by Mr. Perfectionist
center-blockfor centering an element in Bootstrap.
center-block用于在 Bootstrap 中居中元素。
You can test by an image:
您可以通过图像进行测试:
<img class="center-block" src="xxx.PNG"/ >
回答by MAREESKANNNAN RAJENDRAN
try center-blockor use grid columns to center your element. If text use text-center
尝试center-block或使用网格列将元素居中。如果文本使用text-center

