使用 HTML 以響應式的方式截斷表格行內的長文字
要截斷表格行內的長文字,使用以下 CSS −
.table td.demo { max-width: 177px; } .table td.demo span { overflow: hidden; text-overflow: ellipsis; display: inline-block; white-space: nowrap; max-width: 100%; }
以下為 HTML −
<td class = "demo"> <span>This is demo text and we have made it a long text for a demo.</span> </td>
廣告