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.
The word-break property in CSS is used to specify how a word should be broken or split when reaching the end of a line. The word-wrap property is used to split/break long words and wrap them into the next line. word-break: break-all; It is used to break the words at any character to prevent overflow.
The <wbr> element If you know where you want a long string to break, then it is also possible to insert the HTML <wbr> element. This can be useful in cases such as displaying a long URL on a page.
Use word-wrap:break-word; It even works in IE6, which is a pleasant surprise. word-wrap: break-word has been replaced with overflow-wrap: break-word; which works in every modern browser.
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.
The following works for me:
word-wrap: break-word; word-break: break-all; white-space: normal;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With