在HTML和CSS中,如何正确使日语文本换行? [英] In HTML and CSS, how do I make japanese text break lines correctly?

查看:465
本文介绍了在HTML和CSS中,如何正确使日语文本换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用英语和日语写一个简单的段落,仅使用HTML和CSS.英文文本通常会断行(当一个单词不再适合一行时,将被推到下一行).

I'm writting a simple paragraph in both English and Japanese, using only HTML and CSS. The English text breaks lines normally (when a word doesn't fit on a line anymore, it's pushed to the next one).

尽管使用日语,不是将整个单词推到下一行,而只是将其中一部分推到了下一行.我尝试将自动换行设置为断行和常规,但是没有任何变化(日语文本).

With Japanese though, not a whole word is pushed to the next line, but part of it only. I've tried setting word-wrap to break-word and normal, but nothing changes (with the Japanese text).

如何使日语中的整个单词像英语中一样跳到下一行?

How to I make whole words in Japanese jump to the next line like it happens in English?

推荐答案

英语用空格分隔单词,日语用空格分隔.

English separates words with spaces, Japanese doesn't.

日语字符是否构成单词取决于上下文.在许多情况下,寻找某些语法(假名)词可以用来分隔单词-但这甚至接近可靠.

Whether characters in Japanese form a word or not depends on context. In many cases, looking for certain grammatical (Kana) particles could be used to separate words - but this wouldn't even be close to being reliable.

本质上,您需要日语词典/对该语言的理解才能识别单词的开头和结尾-浏览器将不知道该怎么做.

Essentially, you'd need a Japanese dictionary / understanding of the language to identify where the words start and end - a browser won't know how to do this.

或者,如果您知道单词的开头和结尾,则可以将每个空格都包裹在一个跨度中-然后使用CSS确保每个跨度在不合适时都换行成一个整体.

Alternatively, if you know the start and end of the words, you could perhaps wrap each one in a span - then use CSS to ensure each span wraps to a new line as a whole when it doesn't fit.

这篇关于在HTML和CSS中,如何正确使日语文本换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆