目录

style overflowX 属性

示例

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

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

描述

OverflowX 属性指定如何处理内容的左/右边缘 - 如果内容溢出了元素的内容区域。

提示:使用溢出Y属性来确定顶部和底部边缘的剪切。


浏览器支持

Property
overflowX Yes Yes Yes Yes Yes

语法

返回overflowX属性:

object.style.overflowX

设置overflowX属性:

object.style.overflowX = "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-x 属性
CSS版本 CSS3

相关页面

CSS 参考:溢出-x 属性