藉助 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>

更新於:04-03-2020

811 次瀏覽

職業生涯驟啟程

透過完成課程獲得認證

開始
廣告
© . All rights reserved.