cyber0ne 0 Posted November 3, 2005 Report Share Posted November 3, 2005 Suppose I have the following: <style type="text/css">#parent{ width: 750px; margin: auto;}#child{ float: right; width: 250px;}</style><div id="parent"> ... <div id="child"> ... </div></div> In IE, the parent div extends down to fully encompass the child div, even if the child's content is longer than the parent's. But in more standards-compliant browsers, the parent div ends when its non-child content ends, and if the child is longer it extends down out of the parent.Is there any way in CSS to specify the behavior being seen in IE? That is, to have the parent div always fully encompass the child div within its padding, even though it's floated?-cyber0nehttp://www.cyber0ne.com Quote Link to post Share on other sites
zeehond 0 Posted November 4, 2005 Report Share Posted November 4, 2005 Suppose I have the following:<style type="text/css">#parent{ width: 750px; margin: auto;}#child{ float: right; width: 250px;}</style><div id="parent"> ... <div id="child"> ... </div></div> In IE, the parent div extends down to fully encompass the child div, even if the child's content is longer than the parent's. But in more standards-compliant browsers, the parent div ends when its non-child content ends, and if the child is longer it extends down out of the parent.Is there any way in CSS to specify the behavior being seen in IE? That is, to have the parent div always fully encompass the child div within its padding, even though it's floated?-cyber0nehttp://www.cyber0ne.com <{POST_SNAPBACK}> I hope this is what u needput overflow:hidden; in the div that need to stretchotherwise u can put a <br style="clear:right" /> AFTER the floating DIV<style type="text/css">#parent{ width: 750px; margin: auto; overflow:hidden; background-color:#F00;}#child{ float: right; width: 250px; background-color:#0F0;}</style><div id="parent"> ...Parent <div id="child"> ...Child </div><!-- <br style="clear:right" /> THIS br u can use if your not want 2 use the overflow:hidden; in the parent div --></div> Quote Link to post Share on other sites
cyber0ne 0 Posted November 4, 2005 Author Report Share Posted November 4, 2005 overflow: hidden worked perfectly, thanks!-cyber0nehttp://www.cyber0ne.com Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.