To begin, group all of your divs
within a parent div
. This creates a boundary to prevent certain divs
from overpowering others and simplifies the use of the min-width hack.
<div id='container'>
<div id='header'></div>
<div id='body'></div>
<div id='footer'></div>
</div>
Next, in your CSS, utilize the following min-width hack to ensure the minimum width directive functions consistently across all web browsers. The explanation for how this hack operates can be found within the comments. It should be noted that when referencing IE, it pertains to versions 6-7, as IE 8 generally behaves similarly to other browsers.
#header {
min-width:800px; /*minimum width for non-ie browsers, disregarded by ie*/
width: 100% !important; /*width will automatically adjust as needed in non-ie browsers*/
width: 800px; /*ie interprets width as a min-width by default*/
/*Additionally, IE does not acknowledge !important and instead follows the final directive provided*/
}
By following these steps, the header div will expand accordingly as the body div grows larger than its initial size.