I am trying to create a background div that spans the full width of the page while other movable/floating divs are positioned absolutely.
Setting the width to 100% doesn't take into account that the .floater div is off-screen, causing scrollbars to appear.
Example of issue: https://jsfiddle.net/h0arax9o/2/
Scroll to the right in the preview. I want the purple background to cover the entire document.
html:
<div class="background"></div>
<div class="floater"></div>
css:
.background {
background: purple;
width: 100%;
height: 100%;
position: absolute;
}
.floater {
background: red;
width: 200px;
height: 200px;
left: 1400px;
position: absolute;
}
Edit: To clarify, I want the background to span the entire page so that it behaves like an image when scrolling, moving along with the content.
I have updated the example to demonstrate this.