0

I am trying make a horizontally scrollable div which has 3 sub-divisions inside. The sub-divisions have 4 image thumbnails inside them each. I am having trouble to get the this layout working.

HTML

<div class="col-xs-12">
    <div class="canvas-scrollable">
        <ul class="list-inline clearfix">
            <li class="col-xs-12 col-sm-6 col-md-4">
                <table class="item-inner">
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                </table>
            </li>
           <li class="col-xs-12 col-sm-6 col-md-4">
                <table class="item-inner">
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                </table>
            </li>
            <li class="col-xs-12 col-sm-6 col-md-4">
                <table class="item-inner">
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                    <tr>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                        <td class="item-thumb">
                            <img class="img-responsive" src="images/#">
                        </td>
                    </tr>
                </table>
            </li>
        </ul>
    </div>
</div>

CSS

.canvas-scrollable{
    width: 100%;
    height: auto;
    overflow-y: hidden;
    overflow-x: auto;
}

.canvas-scrollable .item-inner{
    height: 300px;
    margin: 10px;
    /*white-space:nowrap;*/
    background: #FFFFFF;
    border: 1px solid rgba(0,0,0,0.1);
    -webkit-box-shadow: 0 13px 8px -10px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 13px 8px -10px rgba(0, 0, 0, 0.1);
    box-shadow: 0 13px 8px -10px rgba(0, 0, 0, 0.1);
}

.item-thumb{
  width: 50%;
  height:50%;
  padding: 4px;
  border: 1px solid green;
}

.item-thumb img{
   height: 100%;
   object-fit: cover;
}

The images won't fit inside the container divs. the height: 100% is making images occupy the entire 300px height of the outermost div.

Please edit my JSFiddle here. Hope I was clear enough with my question

Chandan D Nadig
  • 157
  • 1
  • 4
  • 21
  • Take a look at this. http://stackoverflow.com/questions/19800008/create-horizontally-scrolling-list-item-view-using-bootstrap-columns – roxid Mar 25 '15 at 09:34
  • I actually tried the same example before posting the question here. Everything works great except for the width of
  • . My outermost container "
    " is actually nested inside another wrapper of width col-xs-8. The problem I am facing is, the inner "li"s are ignoring these widths and occupying full page. Can you please edit my fiddle, or the fiddle shown in the other question to have the widths I have specified !! Thank you
  • – Chandan D Nadig Mar 25 '15 at 09:53
  • Guess I got it http://jsfiddle.net/V5zWT/241/ – Chandan D Nadig Mar 25 '15 at 10:23