CSS:display:block; vs display:table; [英] CSS: display:block; vs display:table;
问题描述
display:block;
和 display:table;
之间有区别吗?它看起来像我的dom节点的显示类型包含 table-row
和 table-cell
nodes doesn'事情。 MDN说, 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?
同样, display:inline-block;
和 display:inline-table;
?
推荐答案
比较两者(块和表),我不知道任何核心差异你会在真空中看到。我相信主要的区别是特别是对儿童。表和他们的孩子有一个非常不同的属性/关系比一个div和它的孩子。
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.
对于inline-block和inline-table参见: inline-block和inline-table有什么区别?
As far as inline-block and inline-table see: What is the difference between inline-block and inline-table?
本文( http:// css-tricks。 com / almanac / properties / d / display / )有一些有趣的信息,特别是关于与表相关的所有不同的显示属性。
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.
这篇关于CSS:display:block; vs display:table;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!