I'm trying to break my table cell every 20 characters, but so far I've been unsuccessful.
After some research, I discovered the ch
unit in CSS that can help me set a maximum width like this:
td {
max-width: 20ch;
}
However, simply setting the max-width does not automatically break or wrap my strings. Even when I tried using word-wrap: break-word
, it didn't solve the issue.
td {
max-width: 20ch;
word-wrap: break-word; /* does not work */
}
It's worth noting that most of my cells contain strings without spaces. This might be important information for finding a solution.
EDIT
Apologies for the delayed edit, but I realized that the
<table>
element had the css attributewhite-space: nowrap;
applied by the table library. This was preventingword-wrap: break-word;
from working properly.