BFC Layout Debugger - Free Online Tool | IconVault
Visualize Block Formatting Contexts: float containment, margin collapse and float exclusion with live toggles. Free CSS learning tool.
BFC Layout Debugger
See Block Formatting Contexts fix real layout bugs
5 of 5 free measurements left. All demos render live in your browser.
1. Float containment
A parent with only floated children collapses to zero height, because floats are taken out of normal flow. Creating a Block Formatting Context on the parent (with display: flow-root) makes it wrap its floats again.
See how the dashed border collapsed to a thin strip? The floats escaped the parent's height.
.parent {
/* no BFC: height collapses around floats */
}2. Margin collapse
Two stacked boxes with 40px margins get only a 40px gap, not 80px: adjoining vertical margins collapse. Wrap one box in its own BFC and the margins stop collapsing, giving the full 80px.
Without the wrapper, 40px + 40px collapses to a single 40px gap. Measure it to confirm.
3. Float exclusion zone
Text in normal flow wraps around floats. Put the text in its own BFC and it forms a neat column beside the float instead of flowing underneath it.
.text {
display: flow-root; /* BFC: no float intrusion */
}
/* other ways to create a BFC: */
/* overflow: hidden | auto; display: inline-block; */
/* position: absolute | fixed; contain: layout; */About this tool
IconVault's BFC Layout Debugger makes Block Formatting Contexts visible. Toggle a BFC on and off in three classic scenarios: a parent collapsing around floated children, two margins collapsing into one gap (with a live pixel measurement), and text wrapping under a float versus forming its own column. It is free and runs fully in your browser.
The BFC is one of CSS layout's most misunderstood ideas, yet it explains so many real bugs: the collapsed parent, the margin that refuses to add up, the text that slides under a floated image. Seeing the before and after side by side, with the exact CSS that creates a BFC (display: flow-root, overflow: hidden, and friends), turns a vague concept into a debugging tool you will actually use.
Frequently asked questions
Popular searches
More tools
Algorithm Visualizer
Watch sorting and searching animate step by step
Alt Text Helper
Write better image alt text with live feedback
ARIA Reference
Searchable ARIA roles and attributes guide
Array Visualizer
Step through map, filter, reduce like a debugger
Coming soon
CLI
Coming soon
Figma plugin
Coming soon
VS Code extension
Coming soon
Chrome extension
Coming soon
AI icon generator
Coming soon
Team workspaces
Coming soon