Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to break text at specifc word in an HTML table cell?

I’ve seen many examples using style='"white-space:pre-wrap; word-wrap:break-word"; for example, but I didn’t see how to break the text into multiple lines breaking at specific words.

So, this Fiddle currently displays:

First Name/Appartment, No.137, Joseph South Road, Sec. 2, Fortaleza, Country Tel: +55-8-1234567 email@email.com; email2@email2.com

but it should look like:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

First Name/Appartment, No.137, 
Joseph South Road, Sec. 2, Fortaleza, Country 
Tel: +55-8-1234567 
email@email.com; email2@email2.com

Appreciate any help!

>Solution :

There’s no way that white-space:pre-wrap; can wrap the line as you intended without any indications. Consider manually adding line breaks in your code and use white-space:pre-line; to preserve the breaks:

<table>
  <tr>
    <td class='address' style="white-space: pre-line;">First Name/Appartment, No.137, 
    Joseph South Road, Sec. 2, Fortaleza, Country 
    Tel: +55-8-1234567 
    email@email.com; email2@email2.com
    </td>
  </tr>
</table>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading