国家的定义overflow:hidden:
the overflowing content is completely hidden, not accessible to the user.
来自:http://quirksmode.org/css/css2/overflow.html
但我对我的js小提琴这种行为感到好奇:https: //jsfiddle.net/gd62qmr3/2/
我注意到的一件事是,在将溢出设置为隐藏后,它为边距赋予了颜色?
<div style="background-color:green;overflow:hidden;">
<p>test</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我想知道为什么会出现这种行为?如果没有溢出,精确的块元素将具有绿色背景颜色,但是溢出将为其边缘提供背景颜色.