HTML Force 引入换行符/换行符
我有一个具有固定宽度的表格单元格...
现在该单元格内的内容/文本字符长度有所不同,并且之间不能总是有空格,这会导致布局稍微中断。
我尝试通过添加 CSS word-wrap:break-word 来修复 但由于某种原因,这并不总是有效。
即使文本之间没有空格,如何确保文本断到下一行?
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.
How do I make sure that my text breaks to the next line even if it does not have a space in between ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我编辑了你的 jsfiddle 以便它可以工作:
编辑
http://jsfiddle.net/Dnzra/2/
您所要做的就是添加:
style="table-layout:fixed"
为表格样式,并为单元格设置一些固定宽度。I edited your jsfiddle so that it can work :
EDIT
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.实际的解决方案是在允许直接换行的任何位置插入标签
,例如,为了更好地覆盖旧的
(从未达到任何标准,但仍然活跃),将以下内容添加到样式表中:更多信息:http://www.cs.tut.fi/~jkorpela/html/nobr .html#wbr
The practical solution is to insert the tag
<wbr>
at any point where a direct line break is permissible, e.g.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:More info: http://www.cs.tut.fi/~jkorpela/html/nobr.html#wbr