[英]Break word not working for single long words
In a table where a width size 97% is given, and a long single word like, 在给出宽度为97%的表格中,并给出了一个长单字,
<td style="word-wrap: break-word;">
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</td>
is added to a table cell where word wrap is set to break-word won't break the word. 被添加到表格单元格中,其中自动换行设置为break-word不会破坏单词。 It goes past the set 97% width of the table.
它超出了表的设定宽度97%。
Here is the JSFiddle of the problem, where two tables are created with the same styles but one table with a cell that has a single long word and the other with a paragraph with spaces. 这是问题的JSFiddle,其中创建了两个具有相同样式的表,但其中一个表的单元格具有单个长字,而另一个表的段落带有空格。
http://jsfiddle.net/E5b52/ http://jsfiddle.net/E5b52/
Does anybody know how to solve this? 有人知道如何解决这个问题吗?
EDIT - Note that a FIXED WIDTH cannot be given to the tabled cell. 编辑-请注意,不能将固定宽度指定给表格单元格。
Try this instead: 尝试以下方法:
.table-cell {
display:table-cell;
word-break:break-all;
padding:5px;
}
You should use word-break: break-all;
您应该使用
word-break: break-all;
Use the following CSS property: 使用以下CSS属性:
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all;
white-space: normal;
You should try this: 您应该尝试这样:
.table-cell {
display:table-cell;
padding:5px;
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all;
white-space: normal;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.