Forum Moderators: not2easy

Message Too Old, No Replies

IE Bug. Can't find any solution :(

Please help

         

Dragosh

8:23 am on Nov 2, 2007 (gmt 0)

10+ Year Member



If you are browsing with FF or Opera or Safari you should see the header,the sidebar, and the main content with a green border. I put intentionately the green border to see the bug in IE. In any other browser than IE everything is fine,but in internet explorer between the border and the header of the post div there is an unexplainable space. I have tried many ways with margin and padding but without success.
Maybe a better eye will see where the problem is.
Thanks in advance

index.html


<!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>&lt;ReddisH&gt;</title>
<link href="default.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColElsRtHdr #sidebar1 { padding-top: 30px; }
.twoColElsRtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>

<body class="twoColElsRtHdr">

<div id="container">
<div id="header">
<h1>CssTemplates4Free.110mb.com
<div class="slogan"> always free! </div>
</h1>

<div id="navbutton" style="float:right"> <a href="#">Home</a> <a href="#">Free Css Templates</a> <a href="#">License</a> <a href="#">FAQ</a></div>
<!-- end #header --></div>
<div class="shadow"></div>
<br class="clearfloat" />
<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 the #mainContent div will always contain more content than the #sidebar1 div. </p>
<p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. </p>
<!-- end #sidebar1 --></div>

<div id="mainContent">
<div class="post">
<h3>Title</h3>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam sed diam. Ut egestas lobortis justo. Suspendisse potenti. Nunc eu metus. Curabitur non purus. Vivamus felis ipsum, nonummy eu, pharetra non, imperdiet sit amet, felis. Maecenas tincidunt varius diam. Nulla cursus pellentesque eros. Cras eget odio id dolor auctor venenatis. Phasellus tellus. Nunc pede nulla, rutrum quis, condimentum vel, fermentum sit amet, mauris. In erat nisl, feugiat ac, porta in, consectetuer id, mauris. Curabitur sollicitudin tincidunt metus. Cras tristique augue ultricies purus. Suspendisse risus elit, mollis eget, rutrum sed, faucibus eu, felis. Sed sit amet massa non erat porta convallis. Ut dictum, massa at placerat gravida, purus nisl tristique purus, eu volutpat metus augue in turpis. Donec sem odio, mattis non, dapibus vel, faucibus vitae, pede. Vivamus auctor. Integer quis felis. In lacus dui, dictum quis, placerat id, tincidunt nec, ipsum.
</div>
<div class="post">
<h3>Title two</h3>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam sed diam. Ut egestas lobortis justo. Suspendisse potenti. Nunc eu metus. Curabitur non purus. Vivamus felis ipsum, nonummy eu, pharetra non, imperdiet sit amet, felis. Maecenas tincidunt varius diam. Nulla cursus pellentesque eros. Cras eget odio id dolor auctor venenatis. Phasellus tellus. Nunc pede nulla, rutrum quis, condimentum vel, fermentum sit amet, mauris. In erat nisl, feugiat ac, porta in, consectetuer id, mauris. Curabitur sollicitudin tincidunt metus. Cras tristique augue ultricies purus. Suspendisse risus elit, mollis eget, rutrum sed, faucibus eu, felis. Sed sit amet massa non erat porta convallis. Ut dictum, massa at placerat gravida, purus nisl tristique purus, eu volutpat metus augue in turpis. Donec sem odio, mattis non, dapibus vel, faucibus vitae, pede. Vivamus auctor. Integer quis felis. In lacus dui, dictum quis, placerat id, tincidunt nec, ipsum.
</div>
<!-- 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>

default.css


@charset "utf-8";
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
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;
}

.twoColElsRtHdr #container {
width: 60em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left;
padding:0; /* this overrides the text-align: center on the body element. */
}
.twoColElsRtHdr #header {
background: #ffffff;
padding: 0 10px;
background:url(images/header.png) repeat-x;
height: 120px;
}
.twoColElsRtHdr #navbutton
{
margin-right:2em;
margin-top:10px;
padding-top:80px;
padding-bottom:10px;
margin-bottom:0;
text-decoration:none;

}
.twoColElsRtHdr #navbutton a
{
font-weight:bold;
color:#ff9999;
text-decoration:none;
border-bottom:thick solid #ff9999;
margin-right:10px;
}
.twoColElsRtHdr #navbutton a:hover
{
color:#FFFFFF;
border-bottom:thick solid #ffffff;
}
.twoColElsRtHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding-top:40px;
padding-left:10px;
color:#F9F7ED;
float:left;
font-size:1.5em;
}
.twoColElsRtHdr #header .slogan
{
font-size:small;
padding-left:250px;
font-style:italic;
margin:0;
}
.shadow
{
background:url(images/shadow.png) repeat-x;
height:7px;
}
.twoColElsRtHdr #sidebar1 {
float: right;
width: 12em; /* since this element is floated, a width must be given */
background: #E11D1D; /* the background color will be displayed for the length of the content in the column, but no further */
padding:0 0 15px 0;
margin-top:10px;
border-left: 1px solid #F2F2F2;
}
.twoColElsRtHdr #sidebar1 h3, .twoColElsRtHdr #sidebar1 p {
margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 10px;
padding:0;

}

.twoColElsRtHdr #mainContent
{
margin: 10px 13em 0 10px;
padding: 0 0 0 0;
border:1px solid #00FF00;
}
.twoColElsRtHdr #footer {
margin-top:1em;
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:bottom url(images/bar.png) repeat-x;
}
.twoColElsRtHdr #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 reuse */
.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;
}
.twoColElsRtHdr #mainContent .post
{
margin: 0 0 15px 0;
padding:0 10px 10px 10px;
background:bottom url(images/bar.png) repeat-x;
}
.twoColElsRtHdr #mainContent .post h3
{
margin:0 -10px 16px -10px;
padding:7px 10px 0 10px;
background:url(images/boxback.png) no-repeat;
border: 1px solid #F2F2F2;
font-size: 18px;
height:30px;
width:auto;
}

[edited by: Dragosh at 9:11 am (utc) on Nov. 2, 2007]

Dragosh

12:28 pm on Nov 2, 2007 (gmt 0)

10+ Year Member



Nobody can help me? :(

d40sithui

3:02 pm on Nov 2, 2007 (gmt 0)

10+ Year Member



i think it might be the height and/or padding setting in this class.
reduce it or take it out and see what happens.

.twoColElsRtHdr #header {
background: #ffffff;
padding: 0 10px;
background:url(images/header.png) repeat-x;
height: 120px;
}

ps. thats an overwhelming amount of code.

Dragosh

8:12 pm on Nov 2, 2007 (gmt 0)

10+ Year Member



Actually i found where the problem is :) it was in the comment [if ie] ,it was supposed to be a fix for a bug in ie,but i didnt notice it as it was automatically added by dreamweaver.