Skip to main content

Clear fixes

There are three main ways to clear floats.

1. create and empty div at the bottom of the page. Then set 'clear: both' to that div.

2. create a pseudo element :after, then set
'display: block'
'content: ""'
'clear: both'
properties to it.

3. set 'overflow:hidden' to the parent element. Overflow other than visible will create a block formatting context that will force the parent element to expand to fit the height and width of floated child.

Comments