Bootstrap col-sm-4文本垂直对齐

时间:2016-09-01 04:13:33

标签: twitter-bootstrap-3

我在col-sm-4 div中垂直对齐文本时遇到问题。如您所见,文本不是垂直对齐的。如何解决?

img

这是我的HTML代码



<div class="container">
  <div class="row">
    <h1 class="section-title"> HOW NIBOOK WORKS</h1>
    <div class="col-sm-4"><img src="img/Profile.png" class="how-it-works-step-icon">
      <h1 class="how-it-works-title">Become a "NI"booker</h1>
      <h2 class="how-it-works-subtitle">Create your profile and start sharing your skills and services to locals</h2>
    </div>
    <div class="col-sm-4"><img src="img/bookmark.png" class="how-it-works-step-icon">
      <h1 class="how-it-works-title">Get booked from locals</h1>
      <h2 class="how-it-works-subtitle">Meet in your convenient place to provide your talent</h2>
    </div>
    <div class="col-sm-4"><img src="img/page.png" class="how-it-works-step-icon">
      <h1 class="how-it-works-title">Receive your money</h1>
      <h2 class="how-it-works-subtitle">Get your money directly to your account</h2>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

和我的css

&#13;
&#13;
.how-it-works-title {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 24px;
	font-weight: bold;
	line-height: 18px;
	margin: 25px 0 15px;
	text-align: center;
	padding-top: 10px;
}
.how-it-works-subtitle {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 18px;
	line-height: 18px;
	margin: 25px 0 15px;
	text-align: center;
	padding-top: 10px;
	font-weight: lighter;
	padding-bottom: 10px;
}
.how-it-works-step-icon {
	display: block;
	margin: auto;
}
.section-title {
	font-size: 28px;
	font-color: #4C535D;
	font-weight: bold;
	line-height: 18px;
	margin: 0;
	padding-top: 50px;
	padding-bottom: 60px;
	text-align: center;
	text-transform: uppercase;
}
.section-subtitle {
	font-size: 15px;
	font-weight: normal;
	letter-spacing: 1.5px;
	margin: 10px 0 0 0;
	text-align: center;
}
&#13;
&#13;
&#13;

我是关于bootstrap,css等的新手,所以如果这是一个非常初学的问题我很抱歉

2 个答案:

答案 0 :(得分:7)

这里是最终结果,所有图像都是垂直对齐的,只有一个问题是图像大小我复制了所有代码,并将图像调整为相同大小的88px * 87px,一切正常。我在图像中提供了一条线,供所有垂直对齐

参考

enter image description here

答案 1 :(得分:2)

尝试为图片添加相同的尺寸,profile.img , bookmarkg.png , page.png您的图片看起来大小不同,另外您也可以使用font-awesome字体而不是使用这些图片