
1.word-spacing屬性用於設定HTML頁面中標籤或單字之間的距離。此屬性對英文有效,但對中文無效。
2.word-spacing屬性值有三種類型,Normal、長度值和百分比。
如下圖所示:
Normal:此值根據目前字體的正常間距決定。
長度值:指定單字之間的間距,而不是預設間距。
百分比:指定單字之間的間距,以取代預設間距的百分比。
實例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
margin: 100px;
}
p {
font-size: 16px;
letter-spacing: 0px;
word-spacing: 5px;
line-height: 30px;
}
</style>
</head>
<body>
<div>
<p>hello hello hello hello</p>
<p>測試程式碼 位置測試 程式碼位置</p>
<p>測試程式碼位置測試程式碼位置</p>
</div>
</body>
</html>以上就是css單字間距的介紹,希望對大家有幫助。