Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mtin79/8357353 to your computer and use it in GitHub Desktop.
Save mtin79/8357353 to your computer and use it in GitHub Desktop.
Scroll overflowing list of elements horizontally (without line-breaks). CSS-Only.
.scroll-horizontal
.no-line-breaks.width-auto
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.inline-block
item-01
.scroll-horizontal{
overflow-x: scroll;
overflow-y: hidden;
width:100%;
}
.no-line-breaks{
white-space:nowrap;
}
.width-auto{
width:auto;
}
.inline-block{
display: inline-block;
background: red;
}
@plfort
Copy link

plfort commented Aug 3, 2014

Hello, great snippet!
This solution is very clean, but do you manage to scroll with mouse wheel ? (it does not work for me with Chrome and Firefox)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment