- Jan 30, 2000
- 5,158
- 0
- 71
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:500px; height:150px; z-index:1; background-image: url(images/menuleft.jpg); layer-background-image: url(images/menuleft.jpg); border: 0px none #000000;"></div>
<div id="Layer2" style="position:absolute; left:500px; top:0px; width:100%; height:150px; z-index:2; background-image: url(images/menuback.jpg); layer-background-image: url(images/menuback.jpg); border: 0px none #000000;"></div>
<div id="Layer3" style="position:absolute; right:0px; top:0px; width:150px; height:150px; z-index:3; background-image: url(images/menuright.jpg); layer-background-image: url(images/menuright.jpg); border: 0px none #000000;"></div>
I'm making the transition from tables to CSS for a site layout and needed something that would accomplish the same thing as having a table with one row which is 100% of the site width. The row has three cells, first cell aligned left is locked at a certain pixel width, so is the third cell aligned right, it is also locked at a certain pixel width. When the page gets smaller or larger, the middle cell expands to whatever size it needs to be to make the entire row 100% of the window.
I used three DIVs and was wondering why something like this, would cause the page to be larger than it needs to be. There's nothing else on the page except these few lines, and I think the scroll bar appears because of the the second DIV's 'width:100%' and third DIV's right positioning.
When I scroll the to right, the third DIV which is supposed to stay all the way to the right doesn't move with the scrolling so the second DIV is able to show through. If I resize my browser window, the image correctly moves to the right. The scroll bar shouldn't even be there because there is nothing there that overflows to the right.
I also posted this up on a CSS forum, but with the amount of traffic there, I didn't receive any replies for a day.