在HTML中,是否可以插入一个字换行提示? [英] In HTML, is it possible to insert a word wrapping hint?
问题描述
您好,亲爱的客户。请看看我们的报价。
DIV有一个动态宽度。我想用文字来包装上面的文字。目前,包装发生在最大化第一行长度的单词边界上:
| -DIV WIDTH ---- -------------------------------- |
你好,亲爱的顾客。请看我们的报价
。
我宁愿包装发生在句子边界上。但是,如果不需要包装,我希望该行保持为一个。
为了说明我的观点,请查看各种DIV宽度以及我想要的样式我的文字换行: | -DIV WIDTH ----------------- --------------------------------------- |
你好,亲爱的顾客。请看看我们的报价。
| -DIV WIDTH ----------------------------------- |
你好,亲爱的顾客。
请看看我们的报价。
| -DIV WIDTH -------- |
您好,亲爱的
客户。
请看看我们的报价
。
使用单词,您可以使用一个软连字符,以便在建议的音节边界上进行单词换行。如果不需要包装,& shy;
仍然不可见。如果需要包装,& shy;
就是它发生的地方:
magnifi& shy; cently
有没有类似的方法来暗示HTML中的单词换行? / p>
& shy;
以单词或 < wbr>
, code>< wbr> 不会引入连字符。 另请参阅:
Imagine I have a long, multi-word line of text in a DIV:
Hello there, dear customer. Please have a look at our offer.
The DIV has a dynamic width. I want to word wrap the above text. Currently, the wrapping happens on a word boundary which maximizes the length of the first line:
|-DIV WIDTH------------------------------------|
Hello there, dear customer. Please have a look
at our offer.
I would prefer that the wrapping happen on the sentence boundary. However, if no wrapping is necessary, I would like the line to remain as one.
To illustrate my point, please look at the various DIV widths and how I would like my text to wrap:
|-DIV WIDTH--------------------------------------------------------|
Hello there, dear customer. Please have a look at our offer.
|-DIV WIDTH-----------------------------------|
Hello there, dear customer.
Please have a look at our offer.
|-DIV WIDTH--------|
Hello there, dear
customer.
Please have a look
at our offer.
With words, you can use a soft hyphen so that the word wrapping happens on suggested syllable boundaries. If no wrapping is needed, the ­
remains invisible. If wrapping is needed, the ­
is where it happens:
magnifi­cently
Is there an analogous method for hinting word-wrapping in HTML?
Use ­
in words or <wbr>
between words, as <wbr>
won't introduce a hyphen.
See also:
这篇关于在HTML中,是否可以插入一个字换行提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!