How to make a div grow in height while having floats inside

后端 未结 4 1396
慢半拍i
慢半拍i 2020-12-22 16:24

How can I make a div grow its height when it has floats inside of it? I know that defining a value for the width and setting overflow to hidden works. The problem is that I

4条回答
  •  臣服心动
    2020-12-22 17:25

    There's more than one way to clear floats. You can check some here:
    http://work.arounds.org/issue/3/clearing-floats/

    E.g., clear:both might work for you

    #element:after {
        content:"";
        clear:both;
        display:block;
    }
    
    #element { zoom:1; }
    

提交回复
热议问题