In bootstrap .pull-right for align right .pull-left for align left then What for center ?
3 Answers
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

- 603
- 5
- 10
center-block
for centering an element in Bootstrap.
You can test by an image:
<img class="center-block" src="xxx.PNG"/ >

- 2,605
- 2
- 24
- 35
-
this not working in the case of div – Munasir Pv Sep 08 '16 at 10:21
-
I have mentioned element........... – Mr. Perfectionist Sep 08 '16 at 10:23
try center-block
or use grid columns to center your element. If text use text-center

- 517
- 5
- 17