开发者

Please explain overflow:hidden 's effect on backgrounds?

I know when your elements background 开发者_如何学Cis not behind all of its content, (eg: because of floated elements, positioned elements, margin) adding overflow:hidden fixes the issue, forcing the background to show behind those elements.

For example see this question and meder's answer.

However, when doing this, it is not hiding any overflowing content, so how does setting this effect anything at all?

Basically I know it works, but I want to understand why?


It creates a new block formatting context, which clears the floats.

http://www.w3.org/TR/CSS2/visuren.html#block-formatting

And.. it does clip overflowing content: http://jsfiddle.net/rDmhn/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜