📅  最后修改于: 2020-10-26 04:49:14             🧑  作者: Mango
在某些情况下,元素的内容可能会大于为其分配的空间量。例如,给定的width和height属性不允许有足够的空间容纳元素的内容。
CSS提供了一个称为溢流的属性,该属性告诉浏览器如果盒子的内容大于盒子本身该怎么办。此属性可以采用以下值之一-
Sr.No. | Value & Description |
---|---|
1 |
visible Allows the content to overflow the borders of its containing element. |
2 |
hidden The content of the nested element is simply cut off at the border of the containing element and no scrollbars is visible. |
3 |
scroll The size of the containing element does not change, but the scrollbars are added to allow the user to scroll to see the content. |
4 |
auto The purpose is the same as scroll, but the scrollbar will be shown only if the content does overflow. |
这是一个例子-
Example of scroll value:
I am going to keep lot of content here just to show you how
scrollbars works if there is an overflow in an element box.
This provides your horizontal as well as vertical scrollbars.
Example of auto value:
I am going to keep lot of content here just to show you how
scrollbars works if there is an overflow in an element box.
This provides your horizontal as well as vertical scrollbars.
它将产生以下结果-