HTML DOM textIndent 属性

HTML DOM Style 对象

定义和用法

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

语法:

Object.style.textIndent=length|%

可能的值

描述
length 定义固定的缩进。默认值:0。
% 定义基于父元素宽度的百分比的缩进。
此在线速查手册由www.w↘↙3↘↙x↘↙u↘↙e.com提供,请勿盗用!

实例

本例缩进文本:

<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>

TIY

textIndent - 缩进文本

HTML DOM Style 对象