9/22/2009

中文文字對齊,CSS justify

引用: CSS 中文文字對齊 (Wing R)

文字對齊要在td,div或p之類的tag中設定align="justify" 或用上css設定text-align:justify;

全文完

不對,單純英文文字對齊那是可行的,可是你在中文頁面上設定的話,你也會發現是沒有對齊的效果。由於這問題,早期的網頁是無法做出對齊效果。

中文對齊要利用CSS設定text-aligntext-justify的數值,text-justify是css 2.0以外的屬性,如果要通過w3c的話這一點要多加留意。

一般我自己也會設定成 .justify{ text-align:justify; text-justify: inter-ideograph;}

每當我想要對齊文字時我只要利用它一次就可以。

<div class="style01 justify"> Content <div>Sub Content</div> </div>

P.S.: 有一點需要注意,舊式的Browser支援justify效果不好,最常見的情況是當你的網頁中同時擁有Flash動畫,Div的scrolling內容,內容再加上justify。舊式的Browser會出現嚴重拖慢的情況。(部份css亦發生同樣情況)

另一個情況同是Div的scrolling內容,內容再加上justify,而Div內容中有一部份利用CSS Background設定。舊式的Browser在Scrolling上亦會出現嚴重拖慢的情況。

4 comments:

alib16 said...

great post and creative ideas. I am happy to visit and read useful articles here. I hope you continue to do the sharing through the post to the reader. and good luck for the visitors site, Diskon Gila Disdus.com Bisnis Syariah, Rumah Mungil yang Sehat,

Unknown said...

I can't "justify" paragraphs with both Chinese and English characters on Firefox but IE works fine. Please help.

John Rocks said...

Hey it’s so nice I really want to appreciate to this site. It’s so much interesting matter I like your work. Please carry on with your work and post me such a wonderful article.
Rack Mount Monitor

DevouredF said...

Good blog! Thanks for sharing your thoughts on this. I will read your further posts as well.
Good luck!


Audio editor free