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:
Horizontal scrolling can be achieved by clicking and dragging a horizontal scroll bar, swiping sideways on a desktop trackpad or trackpad mouse, pressing left and right arrow keys, or swiping sideways with one's finger on a touchscreen.
Scroll horizontally using a keyboard and mousePress and hold SHIFT. Scroll up or down using your mouse wheel (or another vertical scrolling function of your mouse).
For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With