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;

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
soft genic
  • 2,016
  • 3
  • 27
  • 44

1 Answers1

4

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

table td {
   word-wrap: break-word;
}
Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
  • I figure out one thing that its necessary to set `width` and `max-width` of the table to make `word-wrap` property work. – soft genic Dec 16 '12 at 15:14
  • @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 – Mr. Alien Dec 16 '12 at 15:15