CSS:显示:块;vs 显示:表格; [英] CSS: display:block; vs display:table;

查看:18
本文介绍了CSS:显示:块;vs 显示:表格;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

display:block;display:table; 有区别吗?在我看来,包含 table-rowtable-cell 节点的 dom-node 的显示类型并不重要.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 its children.

至于内联块和内联表见: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:显示:块;vs 显示:表格;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆