html - 表格单元格中的溢出文本

标签 html css

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

这显示在表格中,类似于:

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

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

看起来像这样:

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

它需要看起来像这样:

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

最佳答案

添加这条 CSS 规则:

td {
    word-break:break-word;
}

jsFiddle example

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

关于html - 表格单元格中的溢出文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15979430/

相关文章:

javascript - 克拉姆当延伸

javascript - 尝试使文本居中时动画消失

javascript - CSS 列数和边距

html - CSS 菜单 - 如何

css - 使用 css 复制 html 元素

c# - 将html有序列表值传递给c#文本框并在sql查询中使用

javascript - 如果我想知道用户何时从输入中删除文本,即使用户不使用键盘,我应该跟踪什么事件

javascript stopPropagation 不适用于输入字段

CSS如何使背景图像像图像一样拉伸(stretch)

HTML img 不会随 CSS 调整大小,无论我尝试什么