I was looking for the best way to clear floats and find this perfect solution, if you take a look at the answer, the solution use display:table
rather than display:block
, the reason is explained:
The use of
table
rather thanblock
is only necessary if using:before
to contain the top-margins of child elements.
I try to understand the meaning, I did some tests but I can't figure out what is the reason for using the display:table
, if anyone can provide a code example to show the difference and the need to use display:table
.
Edit:
Here is a fiddle, I try to test the difference, I'm sure there is one but I can't figure out what to test.
Edit for clarifications:
My question is not about the difference between display block/table
, my question is about the reason for using the display:table
and not display:block
(in relation of clearing floats), there is an explanation brought by Bryan from this answer, but I can't understand the reason, if anyone can explain what the reason and maybe provide a code example that illustrate the difference.