图像滑块与堆叠单元格

时间:2015-01-08 17:53:18

标签: html css twitter-bootstrap

我正在编写一个Web应用程序,其设计需要带有堆叠图像的滚动div(参见图像)

enter image description here

我写了以下HTML

<div class="row">
    <div class="col-md-12"> 
        <div class="item-image-craousel-left"></div>
        <div class="item-image-carousel">
            <div style="background-image: url('http://img2.timeinc.net/people/i/2014/stylewatch/blog/140915/blake-lively-600x450.jpg')" class="main-image"></div>
            <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o1_250.jpg')" class="sub-image"></div>
            <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o2_250.jpg')" class="sub-image"></div>
            <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o3_250.jpg')" class="sub-image"></div>
            <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o4_250.jpg')" class="sub-image"></div>
            <div style="background-image: url('assets/images/tumblr_ncdgtvSlUc1rjtt9yo2_1280.jpg')" class="sub-image"></div>
        </div>
        <div class="item-image-craousel-right"></div>
    </div>
</div>

和CSS:

.item-image-carousel {
    width: 100%;
    display: inline-block;
    overflow-x: auto; 
}

.item-image-craousel-left {
    height: 399px;
    width: 20px;
    background-color: #40d1b0;
    position: absolute;
    text-align: center;
    vertical-align: middle;
    padding-top: 166px;
    display: none;
}

目前我得到的不是溢出的,当我增加宽度时,图像堆叠内联而不是如上图所示的两个块

enter image description here

有人可以告诉我如何在第一张照片中实现布局。我正在使用Bootstrap 3作为它的网格。

1 个答案:

答案 0 :(得分:1)

从我的评论中我的意思是这样......(不知道正确使用'col-md-xx')

<div class="row">
    <div class="col-md-12"> 
        <div class="item-image-craousel-left"></div>
        <div class="item-image-carousel row">
            <div class="col-md-8 main-image" style="background-image: url('http://img2.timeinc.net/people/i/2014/stylewatch/blog/140915/blake-lively-600x450.jpg')"></div>
            <div class="col-md-4">
                <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o1_250.jpg')" class="sub-image"></div>
                <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o2_250.jpg')" class="sub-image"></div>
                <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o3_250.jpg')" class="sub-image"></div>
                <div style="background-image: url('assets/images/tumblr_ma7gmzwfAq1r780z3o4_250.jpg')" class="sub-image"></div>
                <div style="background-image: url('assets/images/tumblr_ncdgtvSlUc1rjtt9yo2_1280.jpg')" class="sub-image"></div>
            </div>
        </div>
        <div class="item-image-craousel-right"></div>
    </div>
</div>