user3780007
user3780007

Reputation: 1

Center image above text in bootstrap

I am trying to make the main page for a website. I want three images with text underneath but the images are not centered above the text. Here is the jsFiddle.

JsFiddle

 <div class="row" style="text-align:center">

            <div class="col-md-4 col-xs-8">
                 <img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
                <h4> Vaccinations</h4>
                <p>Dogs and cats are susceptible to a variety of illnesses that can be completely prevented by following the appropriate vaccination schedule.</p>

            </div>
            <div class="col-md-4 col-xs-8">
                <img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
                <h4>Checkups</h4>
                <p>Regular checkups are a key factor in pet wellness, and can often unearth problems that could lead to health issues down the road.  </p>

            </div>
            <div class="col-md-4 col-xs-8">
                  <img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
                <h4> Senior Pets</h4>
                <p>Senior pets generally require more medical attention than their younger counterparts, just as senior humans do. So when is a pet considered “senior”? </p>

            </div>

        </div>

Upvotes: 0

Views: 1015

Answers (2)

Hello Universe
Hello Universe

Reputation: 3302

.img-responsive{display:inline-block}

Upvotes: 0

Amir5000
Amir5000

Reputation: 1728

You need to set the left and right margins of the images to auto

.col-md-4.col-xs-8 img {
  margin: 0 auto;
}

Updated JSFIDDLE

Upvotes: 1

Related Questions