[英]Word-wrap in an HTML table using display:table-row
A more complex version of: Word-wrap in an HTML table . 更复杂的版本: 在HTML表中自动换行 。
I'm trying to create a nice mobile version of my table. 我正在尝试为表格创建一个不错的移动版本。 I'm using bootstrap media-queries to apply two CSS rules:
我正在使用引导媒体查询来应用两个CSS规则:
display:table-row;
- This puts each cell on a new row. word-wrap:break-word;
- This makes long words go over multiple lines. The trouble is that these two rules seem to conflict. 问题在于这两个规则似乎冲突。 When I use
display:table-row;
当我使用
display:table-row;
, the text does not wrap. ,文字不会自动换行。 Removing
display:table-row;
删除
display:table-row;
causes text to wrap again. 使文本再次换行。
Is there any way I can use both display:table-row;
有什么办法可以同时使用
display:table-row;
and word-wrap:break-word;
和
word-wrap:break-word;
? ?
jsfiddle with code: http://jsfiddle.net/q46Vd/ 带有代码的jsfiddle: http : //jsfiddle.net/q46Vd/
尝试word-break: break-word
而不是word-wrap: break-word
。
Solved it. 解决了。 I replaced
display:table-row
with display:block
. 我用
display:block
替换了display:table-row
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.