用长字包裹表格单元格

Bou*_*ffe 2 html css

我尝试按照这里的解释:如何将表格单元格包装在全宽度表格中的最大宽度

但我不能做一些工作来包装我的"xxxxxxxxxxxxx"线.

<table class="my-list table table-bordered table-hover">
    <tbody>
        <tr>
            <th>User id</th>
            <th>User name</th>
            <th>Type</th>
            <th>Id</th>
            <th>Ad content</th>
            <th>Created at</th>
        </tr>
        <tr>
            <td>66666</td>
            <td>John Smith</td>
            <td>type1</td>
            <td>99999</td>
            <td>
                <div>
                    Good content with words and real sentences.
                </div>
            </td>
            <td>2015-09-02</td>
        </tr>
        <tr>
            <td>777777</td>
            <td>Martin  Isabelle</td>
            <td>type2</td>
            <td>888888</td>
            <td>
                <div>
                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                </div>
            </td>
            <td>2015-09-02</td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/jfmqgh20/2/

SVK*_*SVK 10

更新链接

Css代码:

table {
    width: 100%;
}
td {
    text-align: right;
    white-space: nowrap;
}
td div {
    white-space: normal;
    word-break: break-all;
    display: block;
}
Run Code Online (Sandbox Code Playgroud)

  • 太感谢了!这个简单的解决方案解决了一个痛苦的问题。 (2认同)