The obvious would be to set the min-width on the html element to slightly more than 800px (like 850px). But that implies knowing what width will cause the scrollbar (in this case the 800px banner div). If that's not known, use one of:
Two options I see right off, neither perfect, but both take care of the problem. It would depend upon which downside is less undesirable, as to which you choose.
1)
Code:
html
{
background: -webkit-linear-gradient(left top, red, #000000, blue);
background: -o-linear-gradient(left top, red, #000000, blue);
background: -moz-linear-gradient(left top, red, #000000, blue);
background: -ms-linear-gradient(left top, red, #000000, blue);
background: linear-gradient(left top, red, #000000, blue);
overflow-x: hidden;
}
With that, no horizontal scrollbar can appear. Advantage - can't scroll to see that the background repeats. Problem - really narrow windows/screens cannot see entire page without changing orientation and/or zoom level.
2)
Code:
html
{
background: -webkit-linear-gradient(left top, red, #000000, blue);
background: -o-linear-gradient(left top, red, #000000, blue);
background: -moz-linear-gradient(left top, red, #000000, blue);
background: -ms-linear-gradient(left top, red, #000000, blue);
background: linear-gradient(left top, red, #000000, blue);
width: 200%
}
Now there will always be a scrollbar (the downside), but on the plus side, you can almost never scroll far enough to see a repeat of the background (if the window becomes extremely narrow, you could).
Failing all that (if none of these are acceptable, they do all sort of work), one could use javascript. But it would be jerky sometimes, and of course wouldn't work when javascript was unavailable.
One other option would be to use a gradient image and have it scale. (background-size property set to cover, I believe - unfortunately doesn't work with linear-gradient value, does work with background images though)
Bookmarks