Float left doesn't expand parent DIV
A very common cross browser issue I've seen has been with floating DIVs. This is one of those inconsistencies between the popular browsers that a web developer has to keep in mind every time they develop a new CSS layout. It's very frustrating to create a layout and set a div to float left, but it doesn't expand it's parent DIV if you expect it to. Well it's not supposed to. If you develop in internet explorer you may expect that to work but if you try it in other browsers you will quickly be corrected.
Firefox, Safari, and Chrome all think that a floating div should not stretch the size of its parent div. While IE and Opera think that if a floating div is larger than its parent div, it should stretch. The whole goal to writing a layout like this is for it to work in all of the main browsers. In order to do that you need to write something that they all understand. For this problem, the solution is easy. To accommodate both ideas, all you have to do is use the CSS attribute called overflow and set it to hidden on the "container" div.
Sunday, October 25, 2009
Subscribe to:
Post Comments (Atom)
Thank you sooooo much for this! =)
ReplyDelete