The problem is that there is no content following #wrapper
. To get a horizontal scroll there has to be content anchored on the left edge of the document that becomes hidden when the viewport is narrowed, or said content exceeds the viewport width. Since #wrapper
is floating right, that's impossible because it has no left-side anchor point. :after
makes it work though.
#wrapper { float:right ... }
body:after {
clear:right;
content:' ';
display:block;
height:1px;
min-width:420px
}
The CSS above adds a space after the content of body
, which is #wrapper
. That space is at least the width of #wrapper
's box model, but has no float, and is anchored to the left edge of the viewport. So... as soon as its far right edge is hidden, the horizontal scrolling is triggered; thus giving the illusion that #wrapper
is causing the scroll event.
The fiddle: http://jsfiddle.net/jg3nH/