您的位置:首页 > Web前端 > HTML

HTML DOM overflow 属性

2016-02-22 09:27 429 查看


HTML DOM overflow 属性

HTML DOM Style 对象


定义和用法

overflow 属性规定如何处理如何处理不符合元素框的内容。

语法:

Object.style.overflow=visible|hidden|scroll|auto

可能的值

描述
visible内容不会被修剪,会呈现在元素框之外。
hidden内容会被修剪,但是浏览器不会显示供查看内容的滚动条。
scroll内容会被修剪,但是浏览器会显示滚动条以便查看其余的内容。
auto由浏览器决定如何显示。如果需要,则显示滚动条。


实例

本例使用 overflow 来显示溢出元素框的内容:
<html>
<head>
<style type="text/css">
div
{
border:thin solid green;
width:100px;
height:100px;
}
</style>
<script type="text/javascript">
function hideOverflow()
{
[code]document.getElementById("div1").style.overflow="hidden";

}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="hideOverflow()"
value="Hide overflow" />

</body>
</html>[/code]


TIY

overflow - 隐藏内容溢出
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: