in a td
of a table
i have a very long single word "Pneumonoultramicroscopicsilicovolcanoconiosis" and i want to reduce the width of table
but unable to do because of this long word in one of the td
i can break this word by giving <br />
but is there any CSS way to break this word according to available space. without giving line break or edit anything in HTML.
views:
36answers:
2
+2
A:
td span{display:block;width:your_max_width_here.px}
<td><span>Pneumonoultramicroscopicsilicovolcanoconiosis</span></td>
nicholasklick
2010-07-28 04:16:40
+1 thx for this solution. is there any possibility of other way through pure CSS bcoz table is auto generated by CMS so i can't add `<span>`
metal-gear-solid
2010-07-28 04:18:44
@metal-gear-solid So wrap your value first with 'max-width'd span in your data source before you show it to html.
Jeaffrey Gilbert
2010-07-28 04:56:58
+3
A:
Try the following:
word-wrap: break-word;
white-space: normal;
word-wrap is css3 (however it works in IE). You might not be able to get it working in older browsers however.
Ben Rowe
2010-07-28 04:19:37