Posts: 202
Location: Santa Monica, CA
|
The problem is to combine the outside-in box model with width set to percentages that needs to nest four divs into each other.
______________
<div id="middle_section"> this contains both the "main" section and the "sidebar" section. set to 100%.
<div id="container_main_container"> set to 65%, so it only takes 65% of the width.
<div id="main_container"> this is set to 100% to ensure that all the main div, including padding, is included in the width.
<div id="main" > here's the actual mark-up for main.
</div>
</div>
</div>
<div id="container_sidebar_container"> set to 35%, so it only takes 35% of the width.
<div id="sidebar_container"> this is set to 100% to ensure that all the main div, including padding, is included in the width.
<div id="sidebar" > here's the actual mark-up for sidebar.
</div>
</div>
</div>
</div> closing the div of "middle section" which wraps "main" and "sidebar".
_______________
It's probably overly complex, but it's logical.
1. First you have a div "main" that includes all the mark-up, including the non-scalable paddings and borders.
2. Then you put a div around and set this to 100%. This includes all the paddings and borders in a 100% unit, and so makes everything scalable.
3. Then you put another div around, and set it to 65%. So, these 100% of "main" will only take 65% of width.
4. Then you put another div "middle" around "main" and "sidebar" and set it to 100%, so "main" would be 65% of these 100%, and "sidebar" 35%.
But it's still shrinkwrapping.
What I wrote passed the validator for both XHTML and CSS, but it doesn't work.
PS: In future I will use em for padding and margins for scalability. But it puzzles me why this one doesn't work and all this stuff doesn't stop shrinkwrapping. At the moment it doesn't even get "main" and "sidebar" next to each other. They exceed the 100% and go in line underneath each other, and shrinkwrapped.
Last edited by World; 05-28-2009 at 12:09 AM..
|