简体   繁体   English

HTML Force引入了换行符/换行符

[英]HTML Force introduce break/new line

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 word-wrap: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 ? 我如何确保我的文本即使在中间没有空格的情况下也能下一行呢?

The practical solution is to insert the tag <wbr> at any point where a direct line break is permissible, eg 实际的解决方案是在允许直接换行的任何位置插入标记<wbr> ,例如

<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> (从来没有达到任何标准,但还活着并不断完善)获得更好的浏览器覆盖率,请在样式表中添加以下内容:

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

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"添加: style="table-layout: fixed"并为单元格添加一些固定宽度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM