Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] Firefox and Floaty Things

Started by Boder Dec 14, 2005 at 12:11 AM 6 replies 800+ views
Original Post
Boder
Boder
Can somebody explain to me why floating things are so messed up in firefox. I love the fox but this doesn't make any sense. It's like the floating images are not even part of the paragraph/div and I have to use a bunch of css trickery to get it how it should look by default. What is the reasoning behind how it behaves now? Why can it extend beyond the limits of its container? Thanks all
konForce
konForce
Make sure you are not operating in quirks mode. If the problem still persists, then an example would be nice.
Maugrim_The_Reaper
Maugrim_The_Reaper
In my own experience (hey, its my first post here ;)) Firefox gets it dead right every time - of course that assumes you've specified a doctype so its not rendered in quirks mode.

If you want to post a specific example I'm sure people would be happy to show how to fix it. The thing with floats is figuring out which element should be floated, and where (if needed) there should be a CSS clear: style setting to ensure all following relative postioned blocks are not caught up in the float parade...;)

IE6 does not handle floats correctly as yet - so be careful you don't misinterpret the way IE handles them as correct (its not). Firefox uses the valid CSS2 box model to start with - so its nearly always completely correct.
Open Source PHP DeveloperQuantum Star SE Evolved: Developing an open source space strategy game in PHP.My Blog: Beware of Ramblers!
Sander
Sander
FireFox is right and IE6 is wrong. See http://www.complexspiral.com/publications/containing-floats/ for example, or http://positioniseverything.net/easyclearing.html. The last solution on that last link actually abuses IE's wrong autoclearing behaviour to work around the problem. The real source of all the IE bugs: http://www.satzansatz.de/cssd/onhavinglayout.html. Looks like a relic from Mosaic. And I bet you 10 to 1 that IE7 won't be much better (read: still built on top of Mosaic instead of rewritten to match the CSS specs).
Boder
Boder
Looks like Sander came to save the day while I was posting [smile]. The first link explains the problem pretty well.

I understand how it works now, but I don't agree that the floating element should -by default- expand beyond its container.

[Edited by - Boder on December 14, 2005 4:41:02 PM]
Sander
Sander
Ofcourse they should. If they stick out by default, there are easy ways to contain them if you want to. But, if they are contained by default, how the hell are you going to make them stick out when you want to?
Boder
Boder
Very good point, but

I think there are more occasions where being contained is the desired behavior. And there could be an extra CSS attribute added for float elements to modify this behaviour.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.