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 ?
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.
1 answer