line-height

設定物件中線條之間的距離。

語法

{ line-height: sHeight }

可能的值

sHeight

指定下列其中一個值的變數:

normal

預設值。預設高度。

height

浮點數,後面接著絕對單位指示項 ( cmmminptpc ) 或相對單位指示項 ( emexpx )。

如需支援之長度單位的詳細資訊,請參閱 長度單位參照

percentage

整數,後面接著百分比符號 (%)。此值為父物件的高度百分比。

此屬性的預設值為 normal 。此階層式樣式表屬性不是繼承屬性。

備註

行高是字型下半部與字型內部行距頂端之間的距離。

如果經過格式設定的一行包含多個物件,則會套用行高上限。在此情況下,不允許負值。

範例

下列範例使用 line-height 屬性來控制段落行高。此範例使用 pblockquote 元素作為內嵌 (全域) 樣式表中的選取器,變更所有 pblockquote 元素物件中的行距:

<style>
    p {line-height:8mm}
    blockquote {line-height:4mm}
</style>

標準資訊

您可以在 Cascading Style Sheets (CSS), Level 1 (CSS1) (階層式樣式表 (CSS) 層級 1 (CSS1)) Ee371218.xtlink_newWindow(zh-tw,Expression.40).png 找到此屬性的定義。

適用範圍

a, address, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, div, dl, dt, em, fieldset, form, hn, html, i, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, ol, p, s, select, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

另請參閱

概念

font
font-size