µclearfix
✓ Published0🌍 Public
Aabernier
Last edited Jan 9, 2012
Created on Jan 9, 2012
This example demonstrates the classic micro clearfix hack, a CSS technique for containing floated child elements within a parent container. It shows two blocks floated left and right inside a hot-pink test container, with surrounding paragraphs of placeholder text. The code uses the `.cf:before` and `.cf:after` pseudo-elements with `display:table` and `clear:both` to prevent the parent from collapsing. No JavaScript libraries are used; the solution relies purely on CSS, referencing Nicolas Gallagher’s original clearfix approach. The rendering shows the floats properly contained within the bordered test area.
AI-generated description