CSS percentage width and text-overflow in a table cell

前端 未结 1 1732
北恋
北恋 2020-12-29 07:20

I have a table where the cells\' width is in percentage and I want to use text-overflow: ellipsis to hide long lines of text:

http://jsfiddle.net/Fm5bM/

相关标签:
1条回答
  • 2020-12-29 07:38

    This is easily done by using table-layout: fixed, but "a little tricky" because not many people know about this CSS property.

    table {
      width: 100%;
      table-layout: fixed;
    }
    

    See it in action at the updated fiddle here: http://jsfiddle.net/Fm5bM/4/

    0 讨论(0)
提交回复
热议问题