文本豎排組合 | text-combine-upright (Writing Modes) - CSS 中文開發手冊css
text-combine-upright CSS屬性將多個字符的組合指定到單個字符的空間中。若是組合文本寬於1em,則用戶代理必須調整到1em內的內容。所獲得的組合物被視爲用於佈局和裝飾的單個直立字形。此屬性僅在垂直書寫模式下有效。html
這是用來產生一個在日語中稱爲「中橫」(tate-chū-yoko)的效果,或者是以直書橫向(Chinese)的方式產生的效果。git
/* Keyword values */ text-combine-upright: none; text-combine-upright: all; /* Digits values */ text-combine-upright: digits; /* fits 2 consecutive digits horizontally inside vertical text */ text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally inside vertical text */ /* Global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset;
Initial valueweb |
none瀏覽器 |
---|---|
Applies toide |
non-replaced inline elements佈局 |
Inheritedspa |
yes代理 |
Mediaorm |
visual |
Computed value |
specified keyword, plus integer if 'digits' |
Animation type |
discrete |
Canonical order |
the unique non-ambiguous order defined by the formal grammar |
none——沒有特別的處理。
all——嘗試將水平方框內的全部連續字符排版,以便它們佔據框的垂直線內的單個字符的空間。
digits <integer>?——嘗試顯示一個連續的ASCII數字(U + 0030-U + 0039),該數字與指定的整數具備相同或更少的字符數目,從而佔用垂直線框內單個字符的空間。若是省略整數,則計算出的值最大爲2。範圍以外的整數是無效的。
none | all | [ digits <integer>? ]
當數字被組合時,數字值(digital value)比全部值(all value)所需的標記要少,可是目前並無獲得瀏覽器的普遍支持。
<p lang="ja" class="exampleText">平成20年4月16日に</p>
.exampleText { writing-mode: vertical-lr; text-combine-upright: digits 2; font: 36px serif; }
Screenshot |
Live sample |
---|---|
|
|
all value須要標記每一個水平文本片斷,但相較數字值, 目前它獲得更多瀏覽器的支持。
<p lang="zh-Hant">民國<span class="num">105</span >年<span class="num">4</span >月<span class="num">29</span>日</p>
html { writing-mode: vertical-rl; font: 24px serif } .num { text-combine-upright: all }
Screenshot |
Live sample |
---|---|
|
|
Specification |
Status |
Comment |
---|---|---|
CSS Writing Modes Module Level 3The definition of 'text-combine-upright' in that specification. |
Candidate Recommendation |
Initial definition |
UnknownThe definition of 'text-combine-upright' in that specification. |
Unknown |
Add digits value |
Feature |
Chrome |
Edge |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support |
(Yes)-webkit1 48.0 |
(Yes) |
48.0 (48.0)2 |
11.0-ms3 |
(Yes)-webkit1 |
(Yes)-webkit1 |
digits |
No support |
? |
No support4 |
11.0-ms3 |
No support |
? |
Feature |
Android |
Android Webview |
Edge |
Chrome for Android |
Firefox Mobile (Gecko) |
IE Phone |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support |
No support |
48.0 |
(Yes) |
48.0 |
48.0 (48.0)2 |
No support |
No support |
No support |
digits |
? |
? |
? |
No support4 |
? |
? |
? |
? |