...

View Full Version : Floating div issue in IE8



Ibanez
05-26-2009, 10:18 AM
Hi all!

Im having an issue in IE8 where I have a div, (#specialwrap) within another div (#content).
In FF, Opera and Safari the specials div is floating to the right and the text in my content div is wrapping around it, all is good here.
In IE8 however, #specials is floating right, but the text in #content gets pushed down.

Here is the CSS (http://www.ngb.co.za/ph/include/layout.css)
Here is the HTML (http://www.ngb.co.za/ph/index.html)

Can somebody please tell me why IE8 does this, and how to fix it (Possibly without a hack?)

Thank you!

abduraooft
05-26-2009, 10:25 AM
Have a try by removing width:845px; from #content

Ibanez
05-26-2009, 10:38 AM
Thanx, its working like it should now!

One last thing, could you please explain why this happened? I mean the container div's width stays the same, unless its content is wider than the container...?

abduraooft
05-26-2009, 10:53 AM
Thanx, its working like it should now!

One last thing, could you please explain why this happened? I mean the container div's width stays the same, unless its content is wider than the container...?
That's the property of floated elements. FF allows floated elements to overlap each other, where as IE doesn't. Also, in all browsers, the successor element of a floated element try to occupy the remaining space left by the floated element, unless its cleared(by setting clear in style)

You may experiment it by setting borders around your #content and #specialswrap. Also, setting a suitable margin-right, say margin-right:260px; to your #content (after removing the width applied on it), will give you a 2 column layout(without wrapping the lower portions of #content wrap around the floated element, like http://bonrouge.com/2c-hf-fluid(r).php)

Ibanez
05-26-2009, 11:19 AM
I see!

Thank you once again!:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum