Why the parent div is not being stretched:
Under normal circumstances, if the parent object does not have a height set, the child object can open the child object, but if the child object floats and does not clear the float, in the IE8 or FF browser, the parent object is not able to be stretched, and can be stretched under IE6.
code example:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.51texiao.cn/" /><title>Ant Tribe</title><styletype= "Text/css">. Parent{Border:1px solid Red;width:500px;}. First,.second{float: Left;Height:100px;width:100px;Border:1px solid Blue}</style></Head><Body><Divclass= "Parent"> <Divclass= "First"></Div> <Divclass= "Second"></Div></Div></Body></HTML>
The above code can open the parent div under IE6, but cannot be stretched under the IE8 or FF browser. The workaround is to clear the float. The code is as follows:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.51texiao.cn/" /><title>Ant Tribe</title><styletype= "Text/css">. Parent{Border:1px solid Red;width:500px;Overflow:Hidden}. First,.second{float: Left;Height:100px;width:100px;Border:1px solid Blue}</style></Head><Body><Divclass= "Parent"> <Divclass= "First"></Div> <Divclass= "Second"></Div></Div></Body></HTML>
The original address is: http://www.51texiao.cn/div_cssjiaocheng/2015/0519/1891.html
The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=4699
Why the parent div is not being stretched