【问题标题】:Overflow text in a table cell表格单元格中的溢出文本
【发布时间】:2013-04-16 00:11:22
【问题描述】:

我有一长串没有空格的文件路径。例如:

这显示在table 中,类似于:

<td>
    /thisisthetopfolder/thisisthebottomfolder/thisisthefile.html
</td>

但是,文本不会溢出到下一行,它只是在表格单元格宽度的末尾被截断/截断。我无法增加表格或表格单元格的宽度。有没有办法强制溢出表格单元格中的文本使其不会被切断?

看起来像这样:

------------------------------------------
| /thisisthetopfolder/thisi | other info  |
------------------------------------------

它需要看起来像这样:

------------------------------------------
| /thisisthetopfolder/thisi  |            |
|  sthebottomfolder/thisisth |            |
|  efile.html                | other info |
------------------------------------------

【问题讨论】:

标签: html css


【解决方案1】:

添加此 CSS 规则:

td {
    word-break:break-word;
}

jsFiddle example

word-break CSS 属性用于指定如何(或是否)在单词中换行。

【讨论】:

    猜你喜欢
    • 2012-04-05
    • 2023-01-13
    • 1970-01-01
    • 1970-01-01
    • 2017-07-15
    • 2019-10-27
    相关资源
    最近更新 更多