HTML DOM lineHeight 屬性
定義和用法
lineHeight 屬性設(shè)置行之間的距離(行高)。
語法:
Object.style.lineHeight=normal|number|length|%
可能的值
值 | 描述 |
---|---|
normal | 默認(rèn)。設(shè)置合理的行間距。 |
number | 設(shè)置數(shù)字,此數(shù)字會(huì)與當(dāng)前的字體尺寸相乘來設(shè)置行間距。 |
length | 設(shè)置固定的行間距。 |
% | 基于當(dāng)前字體尺寸的百分比行間距。 |
實(shí)例
本例改變行高:
<html>
<head>
<script type="text/javascript">
function changeLineHeight()
{
document.getElementById("div1").style.lineHeight="2";
}
</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="changeLineHeight()"
value="Change line-height" />
</body>
</html>