Html – How to make a div scroll horizontally

csshtml

I want to create a layout in which I will like to align contents in a horizontal direction but let each row scroll-able in horizontal direction only. Here is my JSFiddle Sample.

.x-scroller{
    overflow-x: scroll; 
    overflow-y:hidden; 
    height:100px; 
    width: 300px
}

The .x-scroller DIV will be dynamically generated in a loop with her contents, each of the x-scroller DIV will equally have some contents which I will like to be able to scroll in horizontal direction only as can be seen in the picture below:

The .x-scroller DIV will dynamically generated in a loop with her contents each of the x-scroller DIV will equally have some contents which I will like to be able to scroll in horizontal direction only

Best Solution

Is this what you're looking for?

.outer {
    width: 500px;
    height: 100px;
    white-space: nowrap;
    position: relative;
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.outer div {
    width: 24.5%;
    background-color: #eee;
    float: none;
    height: 90%;
    margin: 0 0.25%;
    display: inline-block;
    zoom: 1;
}
<div class="outer">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>