I am trying to create a horizontal, scrollable layout for my website. My code looks something like this
<div id="outerWrapper">
<div id="innerWrapper" style="position: relative;">
<div style="width: 200px; position: absolute; top: 0px; left: 0px;">
some lengthy content!
</div>
<div style="width: 200px; position: absolute; top: 0px; left: 220px;">
some lengthy content!
</div>
<div style="width: 200px; position: absolute; top: 0px; left: 440px;">
some lengthy content!
</div>
...
<div style="width: 200px; position: absolute; top: 0; left: 1100px;">
some lengthy content!
</div>
</div>
</div>
I am now trying to add a margin-right to the entire content, so I tried adding margin-right to both the innerWrapper and/or the outerWrapper, but it's ignored. margin-left is working. I actually used the position: absolute
approach instead of float: left
as to avoid these problems, but seems it doesn't work. Any ideas why I can't margin-right the content? Even if I explicitly set the width on the inner or outer wrapper it's still not working.
Interestingly, the body is not having the correct width - the width of the body is the width of the browser window, not the width of the wrappers.
It should be said that the content (innerWrapper and everything below) is created dynamically via JS, if that's important.