word-spacing

設定物件中單字間的額外間距。

語法

{ word-spacing: sSpacing }

可能的值

sSpacing

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

normal

預設值。預設間距。

length

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

此屬性的預設值為 normal 。這是繼承屬性。

備註

此屬性會在每個單字後加上指定的間距。左右對齊會影響字距。

length 值代表在預設的字距中加上額外的間距。允許使用負值。

範例

下列範例顯示如何使用 word-spacing 屬性以增加 span 中單字間的字距。

<style>
   span.spacing{ word-spacing: 10; }
</style>

<script>
function fnChangeSpace(){
    ospan.style.word-spacing = 
       oSelSpace.options[oSelSpace.selectedIndex].text;
}
</script>

<select ID = "oSelSpace" onchange = "fnChangeSpace()">
   <option>10
   <option>15
   <option>20
</select>
<span ID = "ospan" class="spacing">
The quick brown fox jumps over the lazy dog.
</span>

標準資訊

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

適用範圍

a, address, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, 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

另請參閱

概念

letter-spacing