目录

style overflowY 属性

示例

如果文本溢出元素的内容区域,则垂直滚动:

document.getElementById("myDIV").style.overflowY = "scroll";
亲自试一试 »

描述

OverflowY 属性指定如何处理内容的顶部/底部边缘 - 如果内容溢出元素的内容区域。

提示:使用溢出X属性来确定左边缘和右边缘的剪切。


浏览器支持

Property
overflowY Yes Yes Yes Yes Yes

语法

返回overflowY属性:

object.style.overflowY

设置overflowY属性:

object.style.overflowY = "visible|hidden|scroll|auto|initial|inherit"

属性值

Value Description
visible The content is not clipped, and it may be rendered outside the content box
hidden The content is clipped - and no scrolling mechanism is provided
scroll The content is clipped and a scrolling mechanism is provided
auto Should cause a scrolling mechanism to be provided for overflowing boxes
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

技术细节

默认值: 可见的
返回值: 一个 String,表示元素的 Overflow-y 属性
CSS版本 CSS3

相关页面

CSS 参考:溢出-y 属性