Jump to content

[SOLVED] floated div not wrapping around child elements corrently in FF3


ifubad

Recommended Posts

test page http://www.waiming.com/test/pages/catalog.php

 

The floated DIVs wraps around its content as expected in FF2, IE6 & 7, but not FF3

 

I commented out some of the css properties and added borders to make it easier to look at

 

parent DIVs

#catalogContent (dashed black border) it's floated and its automatic width is just enough to wrap around the child thumbnail DIVs plus their outer margins

#subCatalogContent (solid red border)

 

However, in FF3, the div #catalogContent automatic width extends to it's parent div instead, adding the extra space to the right. Can't figure out what is causing that, since it works fine in FF2?

 

 

 

Link to comment
Share on other sites

No width has been applied to any parent block level elements.

 

When a float is applied to a div or any other elements (either a block or inline), no matter what, it turns into a block. But, unlike a normal block that stretches across the complete width of its parent container, a floated block should wrap around the child. Don't know why there is a difference between FF2 and 3, but take a look at this expanded simplified page http://www.waiming.com/test/floatwrapissue.html, which shows different amounts of child DIVs. In FF2, they all wrap 10px pass the right hand box(es), NOT stretching the full width of its parent container. In FF3, they all wrap the same way, except that when there are too many DIVs to fit on the same row and have to wrap to the second row, then that's when the block stretches the full width of its parent, which does not make sense.

 

1. Look at the bottom examples of the page, the first span has block applied, and it stretches the full width of its parent.

2. The second span has only float applied, which automatically turns into a block, but wraps around the content and NOT stretching across. Just so that it is easy to see, I applied height  to it, since it is a block element now.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.