How can I make an element fit to fill the right part of the window?

shadow102

New Member
I have the following html page:\[code\]<body> <div id="div1"></div> <div id="div2"></div></body>\[/code\]And the css is like this:\[code\]#div1{ width: 160px; height: 160px; top: 0; left 0; position: absolute;}#div2{ width: auto; height: 160px; top 0; left: 160px; position: absolute;}\[/code\]How can I make \[code\]div2\[/code\] stretch to fill the right part of the window while the window is being resized. That means the width of \[code\]div1\[/code\] will always be 160px, but the width of \[code\]div2\[/code\] will fit the rest of the window. \[code\]auto\[/code\] didn't work here if there is no content in \[code\]div2\[/code\]. Thanks a lot!
 
Back
Top