Apr 8, 2014

CSS: floated elements with parent collapse and side menu

Having a floating side menu in CSS will cause problems with clearing floating elements in the content. For example, using .clearfix or clear:both will cause the clear to jump under the side menu.

The solution to this is somewhat counter-intuitive, but try using the property overflow:hidden; on the parent of the floating elements.


Now is the time for all good men to come to the aid of their country.
This is non-float content.





Now is the time for all good men to come to the aid of their country.
This parent has {overflow: hidden;}.

No comments: