CSS中的letter-spacing屬性用於設置文本字符之間的間隔行為,即增加或減小文本中字符之間的間隔。
用法:
letter-spacing:normal|length|initial|inherit;
屬性值:
- 正常:當前字體的正常字母間距,即字符之間沒有多餘的空格。這是默認值。
用法:letter-spacing:normal;
例:
<!DOCTYPE html> <html> <head> <title>CSS letter-spacing Property</title> <style> p { letter-spacing:normal; } </style> </head> <body style = "text-align:center;"> <h1 style = "color:green;"> GeeksforGeeks </h1> <h2> CSS letter-spacing Property </h2> <p> This paragraph has letter-spacing:normal; </p> </body> </html>
輸出:
- 長度:除了字符之間的默認間隔外,此模式還指定了額外的inter-character空間。負值也是允許的。
用法:
letter-spacing:length;
例:
<!DOCTYPE html> <html> <head> <title>CSS letter-spacing Property</title> <style> p { letter-spacing:5px; } </style> </head> <body style = "text-align:center;"> <h1 style = "color:green;"> GeeksforGeeks </h1> <h2> CSS letter-spacing Property </h2> <p> This paragraph has letter-spacing:5px; </p> </body> </html>
輸出:
- 初始:此模式將此屬性設置為其默認值。
用法:letter-spacing:initial;
支持的瀏覽器:下麵列出了letter-spacing屬性支持的瀏覽器:
- 穀歌瀏覽器1.0
- Internet Explorer 4.0
- Firefox 1.0
- Opera 3.5
- 蘋果Safari 1.0
相關用法
- HTML Style letterSpacing用法及代碼示例
- CSS transition-property用法及代碼示例
- CSS nav-right用法及代碼示例
- CSS top屬性用法及代碼示例
- CSS all屬性用法及代碼示例
- CSS nav-up用法及代碼示例
- CSS nav-down用法及代碼示例
- CSS right屬性用法及代碼示例
- CSS will-change用法及代碼示例
- HTML li value用法及代碼示例
- CSS border-right用法及代碼示例
- CSS columns屬性用法及代碼示例
- CSS bleed屬性用法及代碼示例
- CSS clear屬性用法及代碼示例
- CSS align-self用法及代碼示例
注:本文由純淨天空篩選整理自Vishal Chaudhary 2大神的英文原創作品 CSS | letter-spacing Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。