Skip to content

Commit a8d0a3a

Browse files
frivoalfantasai
authored andcommitted
[css-text-3] Add Japanese example for keep-all
1 parent 251903d commit a8d0a3a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

css-text-3/Overview.bs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,48 @@ Line Breaking Details</h3>
10321032
</dl>
10331033
</div>
10341034

1035+
<div class="example" id=jp-title-break>
1036+
<style>
1037+
#jp-title-break samp {
1038+
font-size: 2em;
1039+
max-width: 9em;
1040+
line-height: 2;
1041+
padding: 0.5em 1em;
1042+
display: block;
1043+
margin: auto;
1044+
border: solid gray 1px;
1045+
background: white;
1046+
}
1047+
</style>
1048+
<p>Japanese is usually laid out to allow line breaks within words.
1049+
However, it is sometimes preferred to suppress these wrapping opportunities and to only allow wrapping at the end of certain sentence fragments.
1050+
This is most commonly done in very short pieces of text, such as headings, table or figure captions.
1051+
1052+
This can be achieved by marking the allowed wrapping points with <{wbr}> or U+200B ZERO WIDTH SPACE,
1053+
and suppressing the other ones using ''word-break: keep-all''.
1054+
1055+
For instance, the following markup can produce either of the renderings below,
1056+
depending on the value of the 'word-break' property:
1057+
<pre><code highlight=markup>
1058+
&lt;h1>窓ぎわの&lt;wbr>トットちゃん&lt;/h1>
1059+
</code></pre>
1060+
1061+
<table class=data>
1062+
<tr>
1063+
<th><code highlight=css>h1 { word-break: normal }</code>
1064+
<td>
1065+
<samp lang=ja>
1066+
窓ぎわの<wbr>トットちゃん
1067+
</samp>
1068+
<tr>
1069+
<th><pre><code highlight=css>h1 { word-break: keep-all }</code>
1070+
<td>
1071+
<samp style="word-break:keep-all" lang=ja>
1072+
窓ぎわの<wbr>トットちゃん
1073+
</samp>
1074+
</table>
1075+
</div>
1076+
10351077
<p>When shaping scripts such as Arabic
10361078
are allowed to break within words due to ''word-break/break-all''
10371079
the characters must still be shaped

0 commit comments

Comments
 (0)