引用
overflow
Values:
visible | hidden | scroll | auto | inherit
Initial value:
visible
Applies to:
Block-level and replaced elements
Inherited:
No
Computed value:
As specified
If scroll is used, the panning mechanisms (e.g., scrollbars) should always be rendered. To quote the specification, "this avoids any problem with scrollbars appearing or disappearing in a dynamic environment." Thus, even if the element has sufficient space to display all of its content, the scrollbars should still appear. In addition, when printing a page or otherwise displaying the document in a print medium, the content may be displayed as though the value of overflow were
declared as visible.
Scroll 意味着滚动条始终被显示,那么就可以避免在动态文本的容器中滚动条显示、出现造成的种种问题。当在打印介质中,Scroll会默认编程visible,即自动溢出。
If overflow is set to hidden, the element's content is clipped at the edges of the element box, but no scrolling interface should be provided to make the content outside the clipping region accessible to the user.
hidden代表隐藏超出高度的部分
Finally, there is overflow: auto. This allows user agents to determine which behavior to use, although they are encouraged to provide a scrolling mechanism when necessary. This is a potentially useful way to use overflow since user agents could interpret it as "provide scrollbars only when needed." (They may not, but they certainly could and probably should.)
auto是让浏览器自动选择是否显示滚动条
来自CSS Definitive Guide