A margin is a minimal distance between an element and other elements in the same context. Floated elements are basically completely "taken out of context". They don't count for margin calculations. Any element calculating its position relative to other elements based on margins ignores floated elements entirely. So it's not that clear: both
plus margin
doesn't work, it's that margin
ignores floated elements.
The clear: both
merely causes the element to drop below all previous floated elements, its margin calculation does not push it further down because floated elements are ignored in margin calculations.
+-------------------+
| |
| display: block |
| |
+-------------------+
+--------+
--- | |
| | float: |
margin XYZ | | right |
| | |
--- +--------+
+-------------------+ <-- effect of clear: both
| |
| clear: both |
| margin-top: XYZpx |
| |
+-------------------+
The above margin XYZ says the element needs a minimal distance of XYZ to other regular elements. The next element that counts is the regular display: block
element, and the distance to it is plenty. The right floating element is ignored. But the right floating element causes the lower block to be pushed down below its boundary due to clear: both
.