语法:

overflow-xvisible | auto | hidden | scroll

相关属性:overflow , overflow-y

取值:

visible:
不剪切内容也不添加滚动条。假如显式声明此默认值,对象将被剪切为包含对象的window或frame的大小。并且clip属性设置将失效
auto:
此为body对象和textarea的默认值。在需要时剪切内容并添加滚动条
hidden:
不显示超过对象尺寸的内容
scroll:
横向显示滚动条

说明:

  1. 检索或设置当对象的内容超过其指定宽度时如何管理内容。

兼容性:

类型 IEInternet Explorer FirefoxFirefox ChromeChrome OperaOpera SafariSafari
版本 (√)IE6 (√)Firefox 3.0 (√)Chrome 1.0.x (√)Opera 9.63 (√)Safari 3.1
(√)IE7 (√)Firefox 3.5 (√)Chrome 2.0.x (√)Safari 4
(√)IE8

示例:

    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<meta name="robots" content="all" />
<meta name="author" content="Tencent-ISRD" />
<meta name="Copyright" content="Tencent" />
<title>overflow-x</title>
</head>
<body>
<style type="text/css">
  .test_demo {overflow-x: scroll; height: 120px; width: 120px; background:#CCCCCC;}
</style>
<div class="test_demo">
  横向显示滚动条
</div>
</body>
</html>
 

快速跳转