我在网站上有一个菜单部分,包含2行,每行3个项目。我设法使用float:left
使顶行顶部对齐,但我不确定如何顶部对齐底部行。有关如何实现这一目标的任何想法?非常感谢任何和所有建议。
<div id="services">
<div class="banner-image">
<img src="img/large.jpg" alt="BodywoRx room" />
</div><!-- end banner-image -->
<h2>We have a massage that fits YOU.</h2>
<div id="service-list">
<div class="service">
<h3>Coffee Break $25:</h3><p>15 minute chair massage that focuses on the shoulders, neck, arms, wrists and hands.</p>
</div>
<div class="service">
<h3>Lunch Break $40:</h3><p>30 minute table massage that focuses on the shoulders, neck, and lower back.</p>
</div>
<div class="service">
<h3>Lympathic Drainage $50:</h3><p>Session provides congestion relief for the face, throat, and chest.</p>
</div>
<div class="service">
<h3>Bliss $60:</h3><p>60 minute full body massage using light to medium pressure.</p>
</div>
<div class="service">
<h3>Deep Tissue $80:</h3><p>60 minute full body massage using deep pressure.</p>
</div>
<div class="service">
<h3>Correction $95:</h3><p>Session focuses on centering the body and finding and relieving dysfunction that is causing chronic pain and discomfort.</p>
</div>
</div><!-- end service-list -->
#services {
width: 960px;
}
#services .banner-image {
margin-top: 100px;
padding-bottom: 40px;
}
#services h2 {
font-size: 30px;
padding-bottom: 20px;
}
#services #service-list {
margin-left: 40px;
}
.service {
display: inline-block;
float: left;
padding-right: 40px;
width: 265px;
}
答案 0 :(得分:1)
如果通过“顶部对齐”表示保持第二行垂直开始在同一位置(即顶部全部对齐),只需将height:100px;
添加到.service
样式