css - 显示:block; do to an element?到底是什么

标签 css

display:block 的具体规范是什么?我知道将此应用于元素的很多具体操作,但我想听听所有这些。

谢谢。

最佳答案

Quote from W3C

In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block. The vertical distance between two sibling boxes is determined by the 'margin' properties. Vertical margins between adjacent block boxes in a block formatting context collapse.

In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch). This is true even in the presence of floats (although a box's content area may shrink due to the floats).

关于css - 显示:block; do to an element?到底是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/633827/

相关文章:

html - 在这种情况下如何设置 CSS nth-child?

javascript - 更改数组中所选元素的颜色

css - 图像中的圆 Angular

html - 用户点击/触摸 div 时的 CSS 框阴影效果

html - 缩小尺寸(掩模图像)。你能帮助我吗?

javascript - 如何从 dropbox 文件夹应用 CSS 和 JavaScript(用于在博客中使用)

javascript - 宽度不随 JS 变量改变

javascript - 在图像和网页内容之间制作透明的白色覆盖

python - 一个使用 python 的简单 wsgi 网站,但 .css 文件无法加载。为什么?

javascript - iframe 在附加内容之外不再可点击