Rectangle 27 0

css Centering the image in Bootstrap?


.img-responsive {margin:0 auto;}
<img src="images/2.png" class="img-responsive img-center">
<img src="images/2.png" class="img-responsive center-block">
.img-center {margin:0 auto;}

EDIT - With the release of Bootstrap 3.0.1, the center-block class can now be used without any additional CSS..

In Bootstrap 4 alpha 6, the mx-auto class (auto x-axis margins) can be used to center images.

OR, just override the .img-responsive if you're going to center all images..

You could create a new CSS class such as:

Note
Rectangle 27 0

css Centering the image in Bootstrap?


.img-responsive {
     margin: 0 auto;
 }

you can write like above code in your document so no need to add one another class in image tag.

Note