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

成品网站超市图标