Long words in Table: CSS word-wrap and word-break - difference

I need to break long sentences and words in HTML table, mostly because of the mobile version of web, to avoid overflow and keep the width. I have found CSS word-wrap and word-break.

What is the difference between them ?
0
give a positive ratinggive a negative rating
14 Aug 2022 at 06:41 PM
Hi,

Both word-wrap and word-break can give the same results in some cases. But depending on situation and web browser, they can work differently, so it will be good to try what is better you.

Word-wrap allows long words to be able to be broken and wrap onto the next line.

Word-break specifies how words should break when reaching the end of a line.

To prevent overflow and keep the table width, I use word-break: break-word;. When I use word-wrap, the words are broken differently in each cell (column) and the table gets a bit wider than required.
0
give a positive ratinggive a negative rating
15 Aug 2022 at 05:17 PM
Tim
Share on FacebookShare on TwitterShare on LinkedInSend email
x
x
Follow us on Facebook
2022 AnswerTabsTermsContact us