After doing some research and testing a few things, I believe that what you are trying to do cannot be achieved without an additional container, which has a fixed width, since the floating elements stack according to the size of the container.
CSS:
div.horiz-container { border: 1px solid silver; height: 100px; overflow-x: auto; overflow-y: hidden; whitespace: nowrap; width: 400px; } div.horiz-container div.content { float: left; display: inline; height: 100px; width: 500px; } div.horiz-container p { float: left; display: inline; height: 100px; width: 100px; text-align: center; position: relative; }
HTML:
<div class="horiz-container"> <div class="content"> <p>Lorem</p <p>ipsum</p> <p>dolor</p> <p>sit</p> <p>amet</p> </div> </div>
See the demo: http://nikc.kapsi.fi/dev/html/misc/horiz-scroll.html
Also consider a similar question asked earlier: HTML Divs, columns, horizontal scrollbar
source share