How can I make a div scroll horizontally

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>

You can solve this my manipulating the css white-space property

.x-scroller {
    overflow-x: scroll;
    overflow-y:hidden;
    width: 300px;
    white-space: nowrap
}

FIDDLE DEMO


This splits the text into two long horizontal lines, but looks less than desirable given the current text.

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

You can solve this by adding the display property to inline-block. Fiddle Demo

.x-scroller{
    overflow-x: scroll; 
    overflow-y: hidden; 
    height: 100px; 
    width: 300px;
    display: inline-block;
    white-space: nowrap
}

Tags:

Html

Css