Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Is it possible to break Japanese without adding elements?

$
0
0

I know that you can do a line break with zero-width characters and word-break like this:

div {
  display:inline-block;
  font-size:30px;
  width:100px;
  border:1px solid black;
  word-break:keep-all;
}
<div>今日は&#x200B;晴れ&#x200B;です</div>

As this is in the title, it doesn't require any additional elements, so it seems to meet the condition. However, in fact, keep-all prevents the "今日は" part from being broken, which is a problem when there is additional text.

div {
  display:inline-block;
  font-size:30px;
  width:100px;
  border:1px solid black;
  word-break:keep-all;
}
<div>今日はいい天気ですね。&#x200B;晴れ&#x200B;です</div>

I want to get this result in the text above:

div {
  display:inline-block;
  font-size:30px;
  width:100px;
  border:1px solid black;
}
<div>今日はいい天気ですね。<br>晴れ<br>です</div>

Question

I'd like to treat only the "晴れ" part as a lump, but is there a way to do this without the need for additional elements and without causing the above problem?


Viewing all articles
Browse latest Browse all 67497

Trending Articles