HTML DOM textIndent 属性

HTML DOM Style 对象

定义和用法

textIndent 属性缩进元素中的首行文本。

语法:

Object.style.textIndent=length|%

可能的值

描述
length 定义固定的缩进。默认值:0。
% 定义基于父元素宽度的百分比的缩进。

实例

本例缩进文本:

<html>
<head>
<script type="text/javascript">
function setTextIndent()
{
document.getElementById("div1").style.textIndent="50px";
}
</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.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="setTextIndent()"
value="Indent first line of text" />

</body>
</html>

HTML DOM Style 对象

系统帮助 | 给我留言 | 收藏本站
Copyright © 2005-2008 www.cnn84.com All Rights Reserved Ver:2.0
CNN84网是公益性便民网站,是为了给大家的日常生活查询及提供最快捷的出行指南