开发者

What is the means of "margin collapse"? [duplicate]

This question already has answers here: 开发者_如何学JAVA Closed 12 years ago.

Possible Duplicate:

For what reason margin collapse rules were introduced in CSS?

What is the means of "margin collapse"?


It's not a problem, it's a design decision. It means: when adjacent elements have margins that "touch", the two margins are collapsed into the same space. So for example:

_____
| A |    Element A has 20-px bottom margin
|___|

        <-- space between elements is 20, not 40
_____
| B |    Element B has 20-px top margin
|___|

The margins are "collapsed" together. The CSS specification requires browsers to behave this way by design. It is actually a Good Thing and helpful, once you understand when and how it is happening.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜