显示不同的overflow-y属性值:
div.ex1 {
overflow-y: scroll;
}
div.ex2 {
overflow-y: hidden;
}
div.ex3 {
overflow-y: auto;
}
div.ex4 {
overflow-y: visible;
}
亲自试一试 »
这个overflow-y
属性指定当块级元素在顶部和底部边缘溢出时是否裁剪内容、添加滚动条或显示块级元素的溢出内容。
提示:使用溢出-x属性来确定左边缘和右边缘的剪切。
表中的数字指定完全支持该属性的第一个浏览器版本。
后跟 -ms- 的数字指定使用前缀的第一个版本。
Property | |||||
---|---|---|---|---|---|
overflow-y | 4.0 | 9.0 8.0 -ms- |
1.5 | 3.0 | 9.5 |
overflow-y: visible|hidden|scroll|auto|initial|inherit;
Value | Description | Demo |
---|---|---|
visible | The content is not clipped, and it may be rendered outside the content box. This is default | Demo ❯ |
hidden | The content is clipped - and no scrolling mechanism is provided | Demo ❯ |
scroll | The content is clipped and a scrolling mechanism is provided | Demo ❯ |
auto | Should cause a scrolling mechanism to be provided for overflowing boxes | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS教程:CSS 溢出
HTML DOM 参考:溢出属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!