| | |
BUG in Internet Explorer. Please help find a solution!
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 8
Reputation:
Solved Threads: 0
This is my problem: firefox and opera,both show the div correctly,but internet explorer doesnt.
Here is the css:
and this is the page index.html:
For some unknown reason internet explorer shows some space between the mainContent div and the .post div. I tried to marginate and change padding with zero all i could but it didnr solve the problem.
Please help me find a solution
Thanks in advance, Dragos.
Here is the css:
HTML and CSS Syntax (Toggle Plain Text)
@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; border:1px solid #00FF00; padding-top: 0; } .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; margin:0; padding:0; } .twoColElsRtHdr #mainContent div.post { margin: 0 0 15px 0; padding:0 10px 10px 10px; background:bottom url(images/bar.png) repeat-x; } .twoColElsRtHdr #mainContent div.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; }
and this is the page index.html:
HTML and CSS Syntax (Toggle Plain Text)
<!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><ReddisH></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>
For some unknown reason internet explorer shows some space between the mainContent div and the .post div. I tried to marginate and change padding with zero all i could but it didnr solve the problem.
Please help me find a solution

Thanks in advance, Dragos.
The problem is the difference between how Firefox and other browsers correctly interpret the W3C DOM, and the way Internet Exploder mangles it:
The correct (Firefox) way is for a measured box to have the margins, border, and padding OUTSIDE the box.
IE puts these things INSIDE the measured portion of the box.
So with IE, the mainContent margin, border, and padding scrunch in between mainContent and post, instead of being outside mainContent.
The correct (Firefox) way is for a measured box to have the margins, border, and padding OUTSIDE the box.
IE puts these things INSIDE the measured portion of the box.
So with IE, the mainContent margin, border, and padding scrunch in between mainContent and post, instead of being outside mainContent.
Last edited by MidiMagic; Nov 4th, 2007 at 10:14 pm.
Daylight-saving time uses more gasoline
![]() |
Similar Threads
- Internet Explorer (Web Browsers)
- error "cannot find server- Microsoft Internet Explorer". (Web Browsers)
- My Internet Explorer has been invaded :-( (Viruses, Spyware and other Nasties)
- cannot find server - Microsoft Internet Explorer afterdownloading Win Service pack 2 (Networking Hardware Configuration)
- "Internet Explorer could not open the start page" (Web Browsers)
- internet explorer"cannot find server" (Web Browsers)
- IE Error Message 0167:023d68ea (Web Browsers)
- Internet explorer new windows dont open (Web Browsers)
- Internet explorer problems (Web Browsers)
- Internet Explorer Bug lets you run DOS commands remotely (Web Browsers)
Other Threads in the HTML and CSS Forum
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






