how to make a div to wrap two float divs inside?

后端 未结 11 2170
野趣味
野趣味 2020-12-07 15:40

I don\'t know if it\'s a common problem, but I can\'t find the solution in web so far. I would like to have two divs wrapped inside another div, however these two divs insid

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 16:05

    overflow:hidden (as mentioned by @Mikael S) doesn't work in every situation, but it should work in most situations.

    Another option is to use the :after trick:

    .wrapper { min-height: 1px; /* Required for IE7 */ } .wrapper:after { clear: both; display: block; height: 0; overflow: hidden; visibility: hidden; content: "."; font-size: 0; } .col { display: inline; float: left; }

    And for IE6:

    .wrapper { height: 1px; }
    

提交回复
热议问题