overflow: hidden behind padding

后端 未结 4 1897
感动是毒
感动是毒 2021-02-14 04:19

Is it possible to define where overflow: hidden begins based on padding?

For example, I currently have a table in which I have a long string. There is padding on the lef

4条回答
  •  逝去的感伤
    2021-02-14 05:05

    Simply wrap your content in another element and apply the overflow: hidden to that instead:

    table {
       width: 100px;
        table-layout:fixed;  
    }
    
    td {
      border: 1px solid red;
      padding: 10px;
    }
    
    .inner {
        border: 1px solid blue;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    123456789012345678901234567890

提交回复
热议问题