简单的HTML / CSS图片网格

时间:2014-02-05 17:59:10

标签: html css image layout grid

你好,有人可以帮我吗?

如何将这些图像垂直对齐为2行,看起来像这些图像?

Final result

这是我的html / css: http://jsfiddle.net/P9du6/

我试过但它没有按照我想要的方式工作。有人可以帮帮我吗?我认为这是班级垂直对齐。但我不知道如何正确使用它...我期待你的回应。

<div class="container">
    <div class="firstLine">
        <div class="firstPicture">
            <img src="http://textmediauk.com/team/tony.jpg" width="150" height="150"></img><br/><br/>
            <p>Tony, Managing Director</p>
        </div>
        <div class="secondPicture">
            <img src="http://textmediauk.com/team/david.jpg" width="150" height="150"></img><br/><br/>
            <p>David, Sales Director</p>
        </div>
        <div class="thirdPicture">
            <img src="http://textmediauk.com/team/joanne.jpg" width="150" height="150"></img><br/><br/>
            <p>Joanne, IT Director</p>
        </div>
        <div class="fourthPicture">
            <img src="http://textmediauk.com/team/tim.jpg" width="150" height="150"></img><br/><br/>
            <p>Tim, Web Development</p>
        </div>
        <!-- end of the first line -->
        <!-- start of the second line -->
    <div style="secondLine">
        <div class="fifthPicture">
            <img src="http://textmediauk.com/team/usha.jpg" width="150" height="150"></img><br/><br/>
            <p>Usha, Business Sales</p>
        </div>
        <div class="sixthPicture">
            <img src="http://textmediauk.com/team/simon.jpg" width="150" height="150"></img><br/><br/>
            <p>Simon, Online Support</p>
        </div>
        <div class="seventhPicture">
            <img src="http://textmediauk.com/team/janice.jpg" width="150" height="150"></img><br/><br/>
            <p>Janice, Admin Supervisor</p>
        </div>
        <div class="lastPicture">
            <img src="http://textmediauk.com/team/sara.jpg" width="150" height="150"></img><br/><br/>
            <p>Sara, Business Support</p>
        </div>
    </div>
    </div>
</div>

的CSS:

.container{

}

.firstLine{
    width: 100%;
}

.firstPicture{
    width: 25%;
}

.secondPicture{
    width: 25%;
}

.thirdPicture{
    width: 25%;
}

.fourthPicture{
    width: 25%;
}

.fifthPicture{
    width: 25%;
}

.sixthPicture{
    width: 25%;
}

.seventhPicture{
    width: 25%;
}

.lastPicture{
    width: 25%;
}

.secondLine{
    width: 100%
}

提前致谢。

0 个答案:

没有答案