[英]CSS Break Word on Commas
I am trying to break a word based on commas instead of spaces 我试图打破一个基于逗号而不是空格的单词
I have seen the solutions that include adding the <wbr>
tag to your HTML, however, for dynamic information now I need another script to insert it into the HTML text and if the user doesn't have JS enabled it doesn't really do me much good. 我已经看到了解决方案,包括将
<wbr>
标签添加到HTML中,但是,对于动态信息,现在我需要另一个脚本将其插入到HTML文本中,如果用户没有启用JS,则不会真正做到我很好。
As of now, I am using a combination of: 截至目前,我正在使用以下组合:
white-space: break-word;
word-break: break-all;
It works as an OK solution, however, both of these solutions I found ( https://stackoverflow.com/a/15137272/1887101 ; break long-no-spaces-lines on commas, dots, hyphens or other special chars ) are more than 3 years old - so I am wondering if there are any more recent solutions available for this issue? 它可以作为一个好的解决方案,但是,我找到的这两个解决方案( https://stackoverflow.com/a/15137272/1887101 ; 在逗号,点,连字符或其他特殊字符上打破长 - 无空格行 )超过3年 - 所以我想知道是否有更新的解决方案可用于此问题?
Sample string: 示例字符串:
C31C636363-Thermal,80mm, ReStick,Serial,A/C,PSIncluded,EDG
C31C636363-Thermal,80mm,ReStick,串行,A / C,PSIncluded,EDG
Sample break: 样品休息:
C31C636363-Thermal,80mm, ReStick,
C31C636363-Thermal,80mm,ReStick,
Serial,A/C,PSIncluded,EDG
串行,A / C,PSIncluded,EDG
I am trying to break a word based on commas instead of spaces
我试图打破一个基于逗号而不是空格的单词
You can't. 你不能。 CSS does not support that.
CSS不支持这一点。 Breaking on spaces is hard-wired.
打破空间很难接线。
You have no choice but to use JS to pre-process your content to perhaps insert zero-width spaces after commas, or perhaps do that on the server side. 您别无选择,只能使用JS预处理内容,或者在逗号后插入零宽度空格,或者在服务器端执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.