B T B T - 1 month ago 8
CSS Question

CSS: display:block; vs display:table;

Is there a difference between

display:block;
and
display:table;
? It looks to me like the display type of the dom-node containing
table-row
and
table-cell
nodes doesn't matter. MDN says that
display:table;
makes it behave like a table
, but doesn't elaborate on what that behavior is. What is that behavior?

Similarly, is there a difference between
display:inline-block;
and
display:inline-table;
?

Answer

Comparing the two (block and table), I don't know of any core differences (there may be minor ones) you would see within a vacuum. I believe the major differences are specifically to children. Tables and their children have very different attributes/relationships than a div and it's children.

As far as inline-block and inline-table see: What is the difference between inline-block and inline-table?

This article (http://css-tricks.com/almanac/properties/d/display/) has some interesting information, specifically regarding all the different display properties related to a table.

Comments