4

I am facing a very basic issue with table is that on overflow on <td> cell the text flows out of the specified width

Issue looks like something following:

+--------------+
| abcdef@hotmai|.com
+--------------+

I want that on overflow text goes to next line. Something like following.

+--------------+
| abcdef@hotmai|
| .com         |
+--------------+

I tried following css but didnot work: max-width:20%; table-layout:fixed;

1

1 Answer 1

4

Use word-wrap CSS property to wrap your text inside a fixed width td

table td {
   word-wrap: break-word;
}
Sign up to request clarification or add additional context in comments.

2 Comments

I figure out one thing that its necessary to set width and max-width of the table to make word-wrap property work.
@softgenic you need to add width is because td will resize itself, so if you are using a fixed width for your td's so you need to wrap the text using that property so that your text doesn't overflow

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.