Advertisement

09.07.2007 at 11:44AM PDT, ID: 22814130
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

CSS Box Model fix for IE6, works in IE7 and FF2

Asked by baldwin_it in Cascading Style Sheets (CSS)

Tags: , , , ,

I am having some problems getting Internet Explorer v6 to interpret my site correctly. It works fantastic in IE7 and FireFox2, but IE6 isnt working right.

Here is the CSS:

@charset "utf-8";
body  {
      font: 100% Verdana, Arial, Helvetica, sans-serif;
      background: #999999;
      margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
      padding: 5px;
      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;
}
.twoColHybLtHdr #container {
      min-width:580px;
      max-width:1240px;
      width: 80%;  /* this will create a container 80% of the browser width */
      background: none;
      margin: 15px auto 15px auto; /* the auto margins (in conjunction with a width) center the page */
      text-align: left; /* this overrides the text-align: center on the body element. */
}
#header {
      background: #DDDDDD;
      padding: 0 10px;  /* Padding may need to be removed when the image is placed */
      margin: 0 0 15px 0;
}
#header h1 {margin: 0; padding: 10px 0;}


#footer {
      padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
      background:#DDDDDD;
}
#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 */
}

/* Miscellaneous classes for use in any situation */
.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;
}
/************************************/
/* ROUNDED CURVE CSS FOR THE MAIN CONTENT DIV */
/************************************/

.roundedcorner_sidebox { /****** SideBarBox Div - Designates float and no Left/Right margin *******/
      float:left;
      background: url(../images/round/tl.png) no-repeat top left;
      margin: 15px 0 0 0;
      padding: 0;
      width:204px;
      clear:both;


}
.roundedcorner_box {      /****** MainContentBox Div - Cant float because there is no fixed width to prevent the div from dropping *******/
             margin: 30px 0 0 225px;
            background: url(../images/round/tl.png) no-repeat top left;
}


.roundedcorner_content {/****** Creates 4px right edge *******/
      background: url(../images/round/r.png) top right repeat-y;
}

.roundedcorner_top div,.roundedcorner_top,
.roundedcorner_bottom div, .roundedcorner_bottom {
      height: 14px;
      font-size: 1px;
}

.roundedcorner_box p, .roundedcorner_sidebox p {padding: 0 10px 0 10px; }
.roundedcorner_top {background: url(../images/round/tr.png) no-repeat top right;}
.roundedcorner_bottom {background: url(../images/round/bl.png) no-repeat bottom left;}
.roundedcorner_bottom div {background: url(../images/round/br.png) no-repeat bottom right;}
.roundedcorner_content, .roundedcorner_bottom {margin-top: -19px;}

/************************************/
/* THE FOLLOWING DIVS ARE FOR THE CONTENT DIVS THEMSELVES, WHICH ARE CONTAINED WITHIN THE ROUNDED DIVS ABOVE */
/************************************/

#mainContent {
      margin:15px 4px 15px 4px;
      background: #ffffff url(../images/background.gif) top left no-repeat;
      background-position: -220px 0;
}

#sidebar1 {
      background: #ffffff url(../images/background.gif) top left no-repeat;
      margin: 15px 4px 15px 4px;
}
#sidebar2, sidebar3, sidebar4 {
      margin: 0 0 15px 0;
      padding: 5px;
      background: #ffffff;
      margin: 15px 4px 15px 4px;
}
#sidebar1 h3, #sidebar1 p, #mainContent h3, #mainContent p {      margin-left: 10px;       margin-right: 10px;}





Here is the HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColHybLtHdr #sidebar1 { padding-top: 30px; }
.twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */
</style>
<![endif]-->
</head>
<body class="twoColHybLtHdr">
<div id="container">
            <div id="header">
                        <h1>Header</h1>
                        <!-- end #header -->
            </div>
            <!-- THIS IS THE LEFT NAV -->
            <div class="roundedcorner_sidebox">
                        <div class="roundedcorner_top">
                                    <div></div>
                        </div>
                        <div class="roundedcorner_content">
                                    <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 left side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar1 div. </p>
                                                <!-- end #sidebar1 -->
                                    </div>
                        </div>
                        <div class="roundedcorner_bottom">
                                    <div></div>
                        </div>
            </div>
            
            
<div class="roundedcorner_sidebox">
                        <div class="roundedcorner_top">
                                    <div></div>
                        </div>
                        <div class="roundedcorner_content">
                                    <div id="sidebar2">
                                                <h3>sidebar2 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 left side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar1 div. </p>

                                                <!-- end #sidebar1 -->
                                    </div>
                        </div>
                        <div class="roundedcorner_bottom">
                                    <div></div>
                        </div>
            </div>            
            
            
            
            
            
            
            
            
            
            
            
            
            <!-- THIS IS THE MAIN CONTENT -->
            <div class="roundedcorner_box">
                        <div class="roundedcorner_top">
                                    <div></div>
                        </div>
                        <div class="roundedcorner_content">
                                    <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>
                                                
                                    </div>
                                                            </div>
                        <div class="roundedcorner_bottom">
                                    <div> </div>
                        </div>
            </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>



If you want to try to recreate it, here are the images for the CSS corners

bl.png    -   http://img234.imageshack.us/img234/4485/bldt7.png
br.png   -   http://img453.imageshack.us/img453/9897/brsp0.png
r.png     -   http://img212.imageshack.us/img212/7316/57674055yt4.png
tl.png     -   http://img102.imageshack.us/img102/5883/tlhl0.png
tr.png    -   http://img105.imageshack.us/img105/4209/trlo4.png
background.gif  -   http://img513.imageshack.us/img513/8840/backgroundaw8.gif

It should look like this in all browsers, but IE6 is hosed. I'm sure is a box model problem, but am totally lost:

http://img102.imageshack.us/img102/600/correctqu2.gif


This is what it looks like in IE6:

http://img164.imageshack.us/img164/7007/untitledzo2.png


The DIV in question is the right hand one for the main content, not the lefthand sidebars.


Please help!Start Free Trial
[+][-]09.07.2007 at 05:29PM PDT, ID: 19851811

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.10.2007 at 05:10AM PDT, ID: 19860294

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 08:16AM PST, ID: 20673136

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.03.2008 at 09:12PM PST, ID: 20812068

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02.13.2008 at 07:46AM PST, ID: 20885130

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Cascading Style Sheets (CSS)
Tags: css, box, ie6, fix, model
Sign Up Now!
Solution Provided By: baldwin_it
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_1_20070628