Forum Moderators: not2easy

Message Too Old, No Replies

An IE6 CSS float bug stumper

IE 6.0 CSS float bug

         

drewsaur

2:23 pm on Nov 8, 2005 (gmt 0)



Hello, all.

I have searched and searched and searched for details about what I am experiencing, but I can't find a reference anywhere. I know IE has some interesting bugs regarding floats - many of which the insane "display: inline" will fix - but this one us a real stumper.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page</title>
<style type="text/css" media="screen">
body {
background-color: #E0E0E0;
margin: 0;
font-family: lucida grande, lucida sans unicode, lucida sans, trebuchet ms, trebuchet, sans-serif;
font-size: 12px;
line-height: 1.25em;
}

.App {
margin: 10px 5px 12px 5px;
background-color: white;
padding: 0px 0px 5px 0px;
}

.App h2 {
color: #FFDA49;
width: 640px;
background-color: #5E1000;
font-size: 18px;
margin: 0;
padding: 6px 0 6px 10px;
float: left;
}

.AppMeta {
float: right;
padding-top: 5px;
padding-bottom: 12px;
width: 130px;
min-height: 22px;
text-align: left;
}

.App h3 {
color: #A11B00;
font-size: 14px;
margin: 0 10px .5em 10px;
clear: left;
}

.App p {
margin: 0 10px 1em 10px;
}
</style>
</head>
<body>
<div class="App" id="Albert">
<h2>Heading</h2>
<div class="AppMeta">Text</div>
<h3>Heading</h3>
<p>Text</p>
</div>
</body>
</html>

...in IE6 - and then in any other modern browser - and you will see that the left-floated element has space above and below it (margin space, essentially) that IE insists on displaying. No amount of work - apart from disabling the left float completely - seems to affect this.

Any help with this would be greatly appreciated. Thanks!

Drew

[edited by: SuzyUK at 2:03 pm (utc) on Nov. 9, 2005]
[edit reason] URL's snipped - code added [/edit]

alias

4:10 pm on Nov 10, 2005 (gmt 0)

10+ Year Member



The only solution I found is this.
Set the padding and margin of .App to 0 (zeros), and add the following or something alike to the body style:
margin-top: 10px;

It should do the space at the top now on all browsers.
I hope this solution helps.

SuzyUK

12:47 am on Nov 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it is a stumper but unfortunately it is just an IE haslayout error [webmasterworld.com], add a dimension to .App and it should be fine

any element without dimensions in IE has a hard job drawing (or laying out) display:block; elements inside itself

Suzy