Why
is used after multiple floating DIVS in a container DIV?

后端 未结 6 1591
眼角桃花
眼角桃花 2020-12-30 06:25

I have encountered a

at many places, but I am not aware why is it done? Can someone brief me on this, why it is used in
6条回答
  •  温柔的废话
    2020-12-30 06:54

    The Most common problems we face when we write the code with float based layouts is that the parent div container doesn't expand to the height of the child floating elements. The typical solution to fix this is by adding an element with clear float after the floating elements or adding a clearfix to the parent div.

    I am giving you some two good examples for better understanding about clearing floats :-

    http://webdesignerwall.com/tutorials/css-clearing-floats-with-overflow

    http://www.quirksmode.org/css/clearing.html

提交回复
热议问题