【发布时间】:2014-10-07 03:53:46
【问题描述】:
我正在尝试在一个包含两个 50% 宽度单元格的表格中打断长字。
我已经尝试过word-wrap: break-word;,但没有帮助。
HTML
<section class="table-wrapper">
<section class="table-left">
<p>LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG</p>
</section>
<section class="table-right">
<p>SHOOOOOOOOOOOOOOOOOOORT</p>
</section>
</section>
CSS
.table-wrapper {
display:table;
border-collapse:separate;
border-spacing:5px 5px;
width: 100%;
}
.table-left, .table-right {
display: table-cell;
width: 50%;
}
Jsfiddle: http://jsfiddle.net/Lu50tLmf/
如果单词太长,它会破坏整个元素的大小。我该如何解决这个问题?
【问题讨论】:
-
起飞
display:table-cell;和word-wrap:break-word;将工作。 JSFiddle
标签: html css cell css-tables