在bootstrap中的文本上方的中心图像

时间:2014-06-26 17:10:20

标签: html twitter-bootstrap center

我正在尝试制作网站的主页。 我想要三个带有文本的图像,但图像不在文本上方居中。这是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>

2 个答案:

答案 0 :(得分:1)

您需要将图像的左右边距设置为自动

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

更新了JSFIDDLE

答案 1 :(得分:0)

.img-responsive{display:inline-block}