Workaround for Mozilla/Firefox float bug?

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Workaround for Mozilla/Firefox float bug?

Post by DCrazy »

Alright, Mozilla and Firefox both have broken CSS "float" support. Don't believe me? Load up this page in Firefox-0.9.2 or Mozilla-1.7:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Mozilla Float Test</title>
</head>
<body>
<div style="background-color: rgb(192, 192, 192);">
<div style="float: right; height: 10em; width: 5em; background-color: 
rgb(255, 255, 255); border: solid 1px rgb(0, 0, 0);">This is a floating div.  
It's height should stretch its parent's height.  
It's not supposed to be completely independent of its parent.</div>
This is a div.  It should stretch in height according to the height of its children.</div>
</body>
</html>
A real-world example can also be seen here. Note that Internet Explorer renders both examples according to the standard.

Does anyone know a workaround for this bug? I don't want to resort to using tables.

[edit]Wow, noticed another bug in Mozilla/Firefox... The floating div in my example doesn't stretch or clip the text, even though the text is too big for the frame. Strike two for Firefox.[/edit]
User avatar
Sapphire Wolf
DBB Admiral
DBB Admiral
Posts: 1463
Joined: Mon Nov 24, 2003 3:01 am
Location: Nope.avi , gender: male
Contact:

Post by Sapphire Wolf »

Should this be in tech?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

It might get better exposure there but it is an HTML question. I'm looking for a CSS hack, not a browser option. But if I can't get an answer maybe I'll just move it there. :P
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6458
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

I think you looking at a bug in the border attribute, rather than the float attribute.

Opera renders it the same way as FireFox/Mozilla.

as I've read the float spec, all three browsers look to be rendering float correctly, and the test suite confirms as much.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Crap. Re-reading the CSS spec, I see why. "The margins never collapse." :(

There are many similar (and some identical) bugs in Bugzilla though...
User avatar
Nirvana
DBB Harasser
DBB Harasser
Posts: 1123
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Nirvana »

IE
User avatar
Lothar
DBB Ghost Admin
DBB Ghost Admin
Posts: 12133
Joined: Thu Nov 05, 1998 12:01 pm
Location: I'm so glad to be home
Contact:

Post by Lothar »

I see no difference between the puppies page rendered in IE 6.0 and Mozilla 1.5. What am I supposed to be seeing?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

The page has changed; a few days ago the bottom of the background stopped in the middle of that "males" section in Mozilla/Firefox.
Post Reply