在没有 table 布局的情况下包装 table 数据?
Wrapping table data without table-layout?
我需要在 <td>
元素内换行,但我不能使用 css table-layout
属性 因为输出是 html 电子邮件正文和 Outlook 不支持 table-layout
属性.
有没有其他方法可以在 <td>
元素中换行,或者我需要在代码中手动进行换行和测量?
这是我想要实现的目标的示例:
td {
border: solid black 1pt;
font-family: arial;
font-size: 10pt
}
thead td{
text-align:center;
font-weight:bold;
}
table {
border-collapse: collapse
}
<html>
<body>
<table style="width:35pt;height:24pt;table-layout:fixed">
<thead>
<tr>
<td style="width:35pt;height:12pt">Good</td>
</tr>
</thead>
<tbody>
<tr>
<td style="width:35pt;height:12pt;word-wrap:break-word">Costingly Cost Cost</td>
</tr>
</tbody>
</table>
<div style="height:50pt"></div>
<table style="width:35pt;height:24pt;">
<thead>
<tr>
<td style="width:35pt;height:12pt">Bad</td>
</tr>
</thead>
<tbody>
<tr>
<td style="width:35pt;height:12pt" nowrap>Costingly Cost Cost</td>
</tr>
</tbody>
</table>
</body>
</html>
你可以试试这个:
<tr>
<td nowrap>Never increase, beyond what is necessary, the number of entities required to explain anything</td>
<td>Never increase, beyond what is necessary, the number of entities required to explain anything</td>
使用 Microsoft 专有的 word-break:break-all;
<td style="word-break:break-all;">
这应该可以解决问题。
我需要在 <td>
元素内换行,但我不能使用 css table-layout
属性 因为输出是 html 电子邮件正文和 Outlook 不支持 table-layout
属性.
有没有其他方法可以在 <td>
元素中换行,或者我需要在代码中手动进行换行和测量?
这是我想要实现的目标的示例:
td {
border: solid black 1pt;
font-family: arial;
font-size: 10pt
}
thead td{
text-align:center;
font-weight:bold;
}
table {
border-collapse: collapse
}
<html>
<body>
<table style="width:35pt;height:24pt;table-layout:fixed">
<thead>
<tr>
<td style="width:35pt;height:12pt">Good</td>
</tr>
</thead>
<tbody>
<tr>
<td style="width:35pt;height:12pt;word-wrap:break-word">Costingly Cost Cost</td>
</tr>
</tbody>
</table>
<div style="height:50pt"></div>
<table style="width:35pt;height:24pt;">
<thead>
<tr>
<td style="width:35pt;height:12pt">Bad</td>
</tr>
</thead>
<tbody>
<tr>
<td style="width:35pt;height:12pt" nowrap>Costingly Cost Cost</td>
</tr>
</tbody>
</table>
</body>
</html>
你可以试试这个:
<tr>
<td nowrap>Never increase, beyond what is necessary, the number of entities required to explain anything</td>
<td>Never increase, beyond what is necessary, the number of entities required to explain anything</td>
使用 Microsoft 专有的 word-break:break-all;
<td style="word-break:break-all;">
这应该可以解决问题。