显示什么:block;做一个元素? [英] What exactly does display:block; do to an element?
问题描述
display:block的确切规格有哪些?我知道很多应用这个元素的具体事情会做,但我想听到他们。
What are the exact specs of display:block? I know quite a few of the specific things applying this to an element will do but I would like to hear them all.
谢谢。
推荐答案
在块格式化上下文中,框是一个接一个地,包含块的顶部。两个兄弟盒之间的垂直距离由边缘属性确定。在块格式化上下文中相邻块框之间的垂直边距折叠。
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).
这篇关于显示什么:block;做一个元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!