1. 程式人生 > >CSS——文字樣式(text-indent,text-transform,text-decoration,text-justify)

CSS——文字樣式(text-indent,text-transform,text-decoration,text-justify)

text-indent——縮排元素中文字的首行
eg.
p {text-indent: 5em;}, text-indent 還可以設定為負值:p {text-indent: -5em;},
不過在為 text-indent 設定負值時要當心,如果對一個段落設定了負值,那麼首行的某些文字可能會超出瀏覽器視窗的左邊界。為了避免出現這種顯示問題,建議針對負縮排再設定一個外邊距或一些內邊距:p {text-indent: -5em; padding-left: 5em;}

text-transform ——處理文字的大小寫
none:不做處理
uppercase:全大寫
lowercase:全小寫
capitalize:搜字母大寫

text-decoration ——文字裝飾
none:不處理
underline:下劃線
overline:上劃線
line-through:穿透線
blink:文字閃爍

direction——設定文字的方向,是從左向右(預設)。還是從右向左

text-justify——可以使文字的兩端都對齊。在兩端對齊文字中,文字行的左右兩端都放在父元素的內邊界上。然後,調整單詞和字母間的間隔,使各行的長度恰好相等。
注意:要先設定:text-align:justify之後才能設定text-justify的值
eg.
text-align:justify;
text-justify:inter-ideograph;
這樣文字兩端對齊,自動調節字型間距,保證兩端不會留下空白