2

I have searched for this for so long but no luck.

How can I prevent an html table from re-sizing when elements (other tables ) are inside of it I want the elements to overflow from the table when necessary.

 table-layout:fixed; 

The above does not work.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Bob Sanders
  • 51
  • 1
  • 6
  • its not exactly clear to me what you want...are you trying to make an initial layout and overflow outside the table, or do you want it to behave like a word wrap? in that case just put an explicit `width:500px` for example... – Timmerz Apr 24 '13 at 16:38
  • ok the width of the table is 300 and the height is 400. as I add other tables inside the main table the total size of the tables inside the main table add up to more than 400 instead of the table re-sizing to fit the elements inside I want them to overflow – Bob Sanders Apr 24 '13 at 16:46
  • it would be good if you posted the relevant code as well or created a jsfiddle. – Timmerz Apr 24 '13 at 16:52
  • Nested tables? Smells like you're using them for layout purposes. – cimmanon Apr 24 '13 at 17:25

1 Answers1

1

I got this from here.

You can use:

td {
    max-width:30px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
}

EDIT: Ellipsis is optional based on what you want to do with the text.

http://jsfiddle.net/7K9jE/1/

Community
  • 1
  • 1
dewyze
  • 979
  • 1
  • 7
  • 21