Posts Tagged ‘ clear ’

Better way to clear floats

Thank you Mr Moore for this one. Here’s a class that means you don’t have to introduce extra divs to clear floats. Just apply it to the parent.

.clearfix:after {
	visibility: hidden;
	display: block;
	font-size: 0;
	content: " ";
	clear: both;
	height: 0;
	}
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
Advertisements