Connecting Tech Pros Worldwide Help | Site Map

IE6 (of course) Vs. DIV Height 100%

Newbie
 
Join Date: Jul 2009
Posts: 2
#1: Jul 7 '09
I’ve worked around a couple of times with DIVs using height:100% and I had no problems at all, testing on many browsers (IE7, FF3, FF2, Opera, Safari and Chrome).
Now I’ve tried the same idea on a new website and I can’t see what’s going wrong on IE6. The DIV never covers the entire page.

Any ideas? Thanks for your help,

Emerson

The entire code:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.     <head>
  5.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6.  
  7.         <style type="text/css">
  8.             body {background-color:#999999;}
  9.  
  10.             html, body {margin:0; padding:0; height:100%;}
  11.  
  12.             .outerContainer {width:100%; min-height:100%; position:absolute; display:block;}
  13.  
  14.             /* IE6 Hack */
  15.  
  16.             * html .outerContainer {height:100%;}
  17.  
  18.             .mainDiv {width:1000px; margin:0 auto 0 auto; display:block; background-color:#C0C0C0;}
  19.  
  20.             .lockerContainer {width:100%; height:100%; position:absolute; top:0px; left:0px; background-color:transparent; background-color:#000000; opacity:.6; filter:alpha(opacity=60); z-index:20;}
  21.         </style>
  22.     </head>
  23.     <body>
  24.         <div class="outerContainer">
  25.             <div class="mainDiv">
  26.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  27.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  28.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  29.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  30.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  31.                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  32.             </div>
  33.             <div class="lockerContainer"></div>
  34.         </div>
  35.     </body>
  36. </html> 
  37.  
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,559
#2: Jul 7 '09

re: IE6 (of course) Vs. DIV Height 100%


I don't have IE6 available right now to look but 'min-height' has never worked in IE6 while 'height' is treated as min-height.
Newbie
 
Join Date: Jul 2009
Posts: 2
#3: Jul 7 '09

re: IE6 (of course) Vs. DIV Height 100%


Quote:

Originally Posted by drhowarddrfine View Post

I don't have IE6 available right now to look but 'min-height' has never worked in IE6 while 'height' is treated as min-height.

Yes, I know that. That's why I'm using the star hack:

Expand|Select|Wrap|Line Numbers
  1. /* IE6 Hack */
  2.  
  3. * html .outerContainer {height:100%;}
  4.  
Thanks anyway.
Reply

Tags
css, div, height 100%, ie6, internet explorer 6