5

I'm using these code for making wrapper-elements containing their floated children (instead of collapsing):

.wrap:after {
  content: '';
  display: block;
  clear: both;
}

Now I have seen code in which table is used as the value for display.

It's said that this is for "to contain the top-margins of child elements".

Full article here: http://nicolasgallagher.com/micro-clearfix-hack/

I've tinkered around with both variations (block, table) but I couldn't find any difference.

Can someone provide an example which shows the difference between using block or table?

cluster1
  • 4,968
  • 6
  • 32
  • 49

1 Answers1

5

Check out this SO question.

The display: table was needed on earlier days because of browser compatibility. The linked question explains why display: block is better than display: table

Community
  • 1
  • 1
Aides
  • 3,643
  • 5
  • 23
  • 39