Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Adelaide, Australia
    Posts
    472
    Thanks
    3
    Thanked 0 Times in 0 Posts

    100% height in IE in a container div

    Hi there!

    Will someone please able to tell me why the below doe snot work in IE6?


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    	<title>An XHTML 1.0 Strict standard template</title>
    	<meta http-equiv="content-type" 
    		content="text/html;charset=utf-8" />
    <style type="text/css">
    <!--
    
    .box {
    	position:absolute;
    	top: 0px;
    	left: 137px;
    	z-index:512;
    	background-color:#003366;
    	width:20em;
    	height:100%;
    
    }
    
    #container {
    	position: relative;
    	top: 0px;
    	left:0px;
    	margin-left: auto;
    	margin-right: auto;
    	height: auto;
    	width: 100%;
    	z-index: 0;
    	background-color:#124742;
    }
    
    -->
    </style>
    
    
    
    </head>
    <body>
    <div id="container">
    <div class="box"></div>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    blah blah<br>
    
    </div>
    </div>
    </body>
    </html>
    Since the box div is set to 100%, it should fit to the end of the container div but it doe snot. all other browsers it does

    any ideas? please?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Once you make .box position:absolute the #containing div should ignore it because its taken out of flow. I'm not sure what type of layout you are after but from what you've given this has the same effect.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>An XHTML 1.0 Strict standard template</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <style type="text/css">
    html, body {
    margin:0;
    padding:0;
    height:100%;
    background:#124742;
    color:#FFF;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:12px;
    }
    #container {
    background-color:#124742;
    margin-left:137px;
    border-left:300px solid #036;
    min-height:100%;
    }
    * html #container {
    height:100%;
    }
    #left {
    margin-left:-437px;
    width:137px;
    position:relative;
    }
    #left p {
    margin:0;
    padding:5px;
    text-align:justify;
    }
    </style>
    </head>
    <body>
    <div id="container">
    	<div id="left">
    		<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc purus sapien, dictum nec, lobortis sit amet, venenatis a, eros. Aliquam condimentum. Aliquam ullamcorper luctus nulla. In viverra. Curabitur accumsan. Donec vitae erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed sodales convallis magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Sed arcu. Duis dictum, turpis sed consequat scelerisque, nisl odio hendrerit sapien, congue scelerisque nulla arcu in felis. Maecenas nec dolor. Integer hendrerit sagittis nunc. Nullam condimentum. Nullam et tellus ut justo mollis aliquet. </p>
    	</div>
    </div>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •