View Full Version : Scrolling Div Horizontally

11-20-2008, 08:50 PM

I'd like to be able to have a div that has content of text and images in it scroll horizontally, rather than the content and text always wrapping below and it scrolling vertically.

Here is an example of what I'm trying http://noveis.net/scroll/
But rather than the red and yellow images to be below, I want them to the right of the text, and then they div scrolls horizontally.

One thing, I won't know the width of the content in the div before hand, so I can't use 2 divs, the outer one with the set width and the overflow:auto, and the inner one with the width of the content.

Does anyone have a work around for this? I'd be willing to use Javascript if need be.

11-21-2008, 09:28 AM
At the risk of sounding unhelpful, I think you'll find most users balk at horizontal scrolling because it's naturally more comfortable to read short widths of content, which scroll downwards. So my first question is: why does your design necessitate horizontal scrolling?

But anyway, the solution you're looking for, is to apply a left float to your <p> as well as the images. Also, to the <h1> if you feel it necessary to have that floated left, too.
In the usual run of things, most browsers should offer up horizontal bars, to access the material beyond the width of the box.

There should be no need to use Javascript to create a layout; at least, not under normal, sane circumstances. That would be like using a spaceship, to tow a car out of mud.

Hope this helps,