0

我在一个网站上有一个菜单部分,它由 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;
}
4

1 回答 1

1

如果通过“顶部对齐”,您的意思是保持第二行垂直从同一位置开始(即顶部全部对齐)只需添加height:100px;到您的.service样式中

于 2012-07-05T20:15:14.967 回答