Responsive image align center bootstrap 3
There is .center-block
class in Twitter Bootstrap 3 (Since v3.0.1), so use:
<img src="..." alt="..." class="img-responsive center-block" />
Just use .text-center
class if you're using Bootstrap 3.
<div class="text-center">
<img src="..." alt="..."/>
</div>
Note: This doesn't work with img-responsive
Add only the class center-block
to an image, this works with Bootstrap 4 as well:
<img src="..." alt="..." class="center-block" />
Note: center-block
works even when img-responsive
is used
If you're using Bootstrap v3.0.1 or greater, you should use this solution instead. It doesn't override Bootstrap's styles with custom CSS, but instead uses a Bootstrap feature.
My original answer is shown below for posterity
This is a pleasantly easy fix. Because .img-responsive
from Bootstrap already sets display: block
, you can use margin: 0 auto
to center the image:
.product .img-responsive {
margin: 0 auto;
}