How do you make table cells show as much text as fits in one line, like GMail and Google Reader?

后端 未结 3 456
忘了有多久
忘了有多久 2021-02-04 11:32

What is the best way to make a table (not necessarily using the table tag) where each row has a fixed height and fills the entire available horizontal space and one of the colum

3条回答
  •  暖寄归人
    2021-02-04 11:59

    See: http://jsfiddle.net/gtRnn/

    What is the best way *snip*

    p { border: 1px dashed #666; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }

    Each property is doing something useful:

    • white-space: nowrap forces the text to stay on one line.
    • overflow: hidden stops this.
    • text-overflow: ellipsis works in "all browsers", except Firefox (support is planned)
    • border is there for no reason.

提交回复
热议问题