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.

4
  • 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... Commented Apr 24, 2013 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 Commented Apr 24, 2013 at 16:46
  • it would be good if you posted the relevant code as well or created a jsfiddle. Commented Apr 24, 2013 at 16:52
  • Nested tables? Smells like you're using them for layout purposes. Commented Apr 24, 2013 at 17:25

1 Answer 1

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/

Sign up to request clarification or add additional context in comments.

3 Comments

Can this be used for the height of the table as well?
Can you be more specific? You have tables inside of tables? Is this the most efficient way to do this? It would be helpful to post come code.
this worked perfectly! I used max-width:auto; though

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.