如何模仿断言:断言;对于IE9,IE11和Firefox?
它似乎适用于Chrome.我已经了解并理解它只是一个非标准的webkit.
仅供参考,我尝试过使用,
white-space: pre-wrap;
而更像是,
overflow-wrap: break-word;
还尝试了下面提到的CSS,
word-wrap: break-word; word-break: break-word;
但这些似乎不起作用.
I can’t provide fixed width to the span(which contains the text) by making it
display: block;
explicitly as the text is dynamic and will differ according to the user’s Geo-location. Currently we support around 18 languages.
这是代码的外观,
HTML,
<div id="grid2"> <span id="theSpan">Product Support</span> </div>
CSS,
#theSpan{ white-space: pre-wrap; /* CSS3 */ white-space: -moz-pre-wrap; /* Firefox */ white-space: -pre-wrap; /* Opera 7 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* IE */ word-break: break-all; } #grid2{ width: 100px; }
看起来像这样,
我希望它像,
请注意:
我不得不使用word-break:break-all;至于某些语言,翻译后的文本太长而且溢出了网格. “产品支持”一词是动态的.
更新:
我有一个固定宽度的div,id为grid2.在其中一种语言中,翻译的文本太长,它是一个单词,它流出grid2 div.
也更新了代码.
解决方法
原文地址:https://www.jb51.cc/html/227789.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。