Small IE 7 & 8 fix needed please.

Discussion in 'CSS' started by y0y0y0, Aug 27, 2009.

  1. #1
    Ok, different issue now. Ive started from scratch.

    The site is http://www.haskells.info/testing/test2.htm

    My problem:
    At the bottom of the page you can see that the dark brown main content will not slide up next to the footer. The side bar does fine but not the main content or container. It works fine is Firefox. Please take a look at my site and the code below. I need a fix for IE 7 and 8. And yes I have validated both the xhtml and css.

    Thanks,

    Josh:)

    P.S.
    I have attached a pic of the problem if you don't visit the site. The dark brown content area will not rest along the footer. There is a small gap of space.



    xhtml code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test2</title>
    <link href="_css/test2.css" rel="stylesheet" type="text/css" /><!--[if IE 5]>
    <style type="text/css"> 
    /* place css box model fixes for IE 5* in this conditional comment */
    .twoColFixRtHdr #sidebar1 { width: 220px; }
    </style>
    <![endif]--><!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    .twoColFixRtHdr #sidebar1 { padding-top: 30px; }
    .twoColFixRtHdr #mainContent { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->
    </head>
    
    <body class="twoColFixRtHdr">
    
    <div id="container">
      <div id="header">
    
      <!-- end #header --></div>
      <div id="sidebar1">
        <h3>Sidebar1 Content</h3>
        <p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the right side of the #mainContent div if it will always contain more content. </p>
        <p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque  eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend  sollicitudin, molestie id, varius et, nibh. Donec nec libero.</p>
      <!-- end #sidebar1 --></div>
      <div id="mainContent">
        <h1> Main Content </h1>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce  varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id,  libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat  feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut,  sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh.  Donec nec libero.</p>
        <h2>H2 level heading </h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
    	<!-- end #mainContent --></div>
    	<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
      <div id="footer">
        <p>Footer</p>
      <!-- end #footer --></div>
    <!-- end #container --></div>
    </body>
    </html>
    
    HTML:
    CSS CODE:
    @charset "utf-8";
    body  {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    	padding: 0;
    	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    	color: #000000;
    	background-image: url(../_images/green_Bg.png);
    }
    #container {
    	position: relative;
    	width: 945.5px;
    	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    	border: 0px;
    	padding: 0px 0px 0px 0px;
    } 
    #header {
    	padding: 0 0px 0 0px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    	background-image: url(../_images/fake_header.png);
    	height: 168px;
    	width: 945px;
    } 
    #sidebar1 {
    	width: 265px; /* the background color will be displayed for the length of the content in the column, but no further */
    	padding: 15px 10px;
    	background-image: url(../_images/tan_Cloth.png);
    	height: 1000px;
    	border-right-width: 3px;
    	border-right-color: #FFF;
    	border-right-style: solid;
    	float: right;
    }
    #mainContent {
    	position: relative;
    	margin: 0px 0px 0px 0px; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    	padding: 20px 20px 0px 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
    	border-left-width: 3px;
    	border-left-color: #FFF;
    	border-left-style: solid;
    	width: 610px;
    	height: 1010px;
    	color: #FFF;
    	text-align: left;
    	background-image: url(../_images/dark_brown_cloth.png);
    	border-right-width: 3px;
    	border-right-color: #FFF;
    	border-right-style: solid;
    	float: left;
    } 
    #footer {
    	padding: 0 10px 0 20px;
    	background-image: url(../_images/blue_Bg.png);
    	width: 915px;
    } 
    #footer p {
    	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    	padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    }
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    	float: right;
    	margin-left: 8px;
    }
    .fltlft { /* this class can be used to float an element left in your page */
    	float: left;
    	margin-right: 8px;
    }
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    	clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }
    
    Code (markup):
     

    Attached Files:

    y0y0y0, Aug 27, 2009 IP
  2. ywp

    ywp Peon

    Messages:
    96
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Make a single image in Photoshop... (From left to right: white border > brown cloth > white border > tan cloth > white border.) Make it the background image for your container div.

    Get rid of height and background image in #mainContent and #sidebar1 because content in either div will push #container to the footer.

    Here's the code:

    #container {
    background: url(_images/combination.png) top left repeat-y; // Add to existing code.
    }

    As a bonus you'll save bandwidth, since your current pictures are big.
     
    ywp, Aug 28, 2009 IP
  3. y0y0y0

    y0y0y0 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ohhhhh! Thanks a ton. That makes much more sense to do it that way and it works!
    :D
     
    y0y0y0, Aug 29, 2009 IP