HTML Force引入了break / new行

时间:2021-04-21 20:23:34

I have a table cell with some fixed width...

我有一个固定宽度的表格单元格...

Now the content/text charcter length inside this cell varies and cannot always have a space in between which causes the layout to break slightly.

现在,此单元格内的内容/文本字符长度各不相同,并且不能总是在它们之间留有空格,这会导致布局略微破坏。

I tried fixing by adding the CSS word-wrap:break-word But for some reason, this does not work always.

我尝试通过添加CSS自动换行来修复:break-word但由于某种原因,这并不总是有效。

How do I make sure that my text breaks to the next line even if it does not have a space in between ?

即使它之间没有空格,我如何确保我的文本中断到下一行?

2 个解决方案

#1


0  

I edited your jsfiddle so that it can work :

我编辑了你的jsfiddle以便它可以工作:

EDIT http://jsfiddle.net/Dnzra/2/

编辑http://jsfiddle.net/Dnzra/2/

All you have to do, is to add : style="table-layout: fixed" to the table style and some fixed width to your cells.

您所要做的就是将:style =“table-layout:fixed”添加到表格样式中,并为您的单元格添加一些固定宽度。

#2


0  

The practical solution is to insert the tag <wbr> at any point where a direct line break is permissible, e.g.

实际的解决方案是在允许直接换行的任何点插入标签,例如,

<td>MaxUName<wbr>MaxUName<wbr>MaxUName<wbr>MaxUNa</td>

To get somewhat better browser coverage for the good old <wbr> (which never made its way to any standard but is alive and kicking), add the following into your style sheet:

为了获得更好的旧浏览器覆盖率(它从未达到任何标准,但仍然活着并且正在踢),请在样式表中添加以下内容:

wbr:after { content: "\00200B"; }

More info: http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr

更多信息:http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr

#1


0  

I edited your jsfiddle so that it can work :

我编辑了你的jsfiddle以便它可以工作:

EDIT http://jsfiddle.net/Dnzra/2/

编辑http://jsfiddle.net/Dnzra/2/

All you have to do, is to add : style="table-layout: fixed" to the table style and some fixed width to your cells.

您所要做的就是将:style =“table-layout:fixed”添加到表格样式中,并为您的单元格添加一些固定宽度。

#2


0  

The practical solution is to insert the tag <wbr> at any point where a direct line break is permissible, e.g.

实际的解决方案是在允许直接换行的任何点插入标签,例如,

<td>MaxUName<wbr>MaxUName<wbr>MaxUName<wbr>MaxUNa</td>

To get somewhat better browser coverage for the good old <wbr> (which never made its way to any standard but is alive and kicking), add the following into your style sheet:

为了获得更好的旧浏览器覆盖率(它从未达到任何标准,但仍然活着并且正在踢),请在样式表中添加以下内容:

wbr:after { content: "\00200B"; }

More info: http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr

更多信息:http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr