我需要將文本包裝到<td>
元素中,但我無法使用css table-layout
屬性作爲輸出到html電子郵件正文,並且Outlook不支持table-layout
屬性。無表格佈局的表格數據包裝?
是否有其他方式來包裝<td>
元素中的文本,還是我需要在代碼中手動執行換行和測量?
這裏是什麼,我想acheive一個例子:
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>
試一試這個方法:[HTML TD wrap text](https://stackoverflow.com/questions/1057574/html-td-wrap-text)。我知道它不適用於電子郵件,而是一般的表格。 – Syfer
不幸的是,這並不好。所有建議的解決方案都依賴於使用'table-layout'或'max-width' css屬性;這兩者都不被Outlook支持。 –
這是電子郵件:https://stackoverflow.com/questions/10096012/break-long-words-in-html-email-in-outlook-2010 – Syfer