如何在< td>内换行没有空格的文本? [英] How do I wrap text with no whitespace inside a <td>?

查看:116
本文介绍了如何在< td>内换行没有空格的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用过:

word-break:break-all;
table-layout:fixed;

,文字在Chrome中自动换行,但在Firefox中不自动换行.

and the text wraps in Chrome but not Firefox.

更新:我决定更改设计,因此它不需要包装.试图弄清CSS修复/黑客程序令人沮丧且耗时.

Update: I decided to change the design so it didn't need the wrap; trying to sort out a CSS fix/hack was proving too frustrating and time consuming.

推荐答案

尝试一下,我认为这将适用于"AAAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGGGG" 会产生

Try this, I think this will work for something like "AAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGG" will produce

AARRRRRRRRRRRRRRRRRRRR
RRGGGGGGGGGGGGGGGGGGGG
G

我从Google上的几个不同网站上借鉴了我的榜样.我已经在ff 5.0,IE 8.0和Chrome 10上对此进行了测试.

I have taken my example from a couple different websites on Google. I have tested this on ff 5.0, IE 8.0, and Chrome 10.

.wrapword {
    white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
    white-space: -webkit-pre-wrap;          /* Chrome & Safari */ 
    white-space: -pre-wrap;                 /* Opera 4-6 */
    white-space: -o-pre-wrap;               /* Opera 7 */
    white-space: pre-wrap;                  /* CSS3 */
    word-wrap: break-word;                  /* Internet Explorer 5.5+ */
    word-break: break-all;
    white-space: normal;
}

<table style="table-layout:fixed; width:400px">
    <tr>
        <td class="wrapword">
        </td>
    </tr>
</table>

这篇关于如何在&lt; td&gt;内换行没有空格的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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