"overflow-wrap: break-word" not working in table
See original GitHub issueI’m implementing table inside html, but line break seems not working in items in table. This is CSS
table {
...
td, th {
padding: 5px 15px 5px 15px;
word-break: break-all;
white-space:nowrap;
}
and HTML
...
<div class="item-box">
<table>
...
<tr>
<td>TD1</td>
<td>
TD2lsneinocnosneonocnsoneoincosneoicnosneocnsoinoiesnioencTD2lsneinocnosneonocnsoneoincosneoicnosneocnsoinoiesnioencTD2lsneinocnosneonocnsoneoincosneoicnosneocnsoinoiesnioenc</td>
<td>TD3</td>
</tr>
...
and it shows like this.
Is there something I’m doing wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Using "word-wrap: break-word" within a table - Stack Overflow
That is, the table stops narrowing after step 2 and step 3 doesn't ever happen. The break-word doesn't seem to be filtering down....
Read more >Word break styling in a table cell does not work if text ... - GitHub
Word break styling in a table cell does not work if text is not contained within ... tried using also "overflow-wrap: anywhere" to...
Read more >How to break long words in an HTML (or CSS) table
word -wrap prevents a long word from overflowing its container by breaking the text onto the next line. It works fine when applied...
Read more >wrap, overflow - wrap - , and - word - break - LogRocket Blog
To get the table to fit within its container and overflow-wrap to work, set the value of the table-layout property to fixed and...
Read more >overflow-wrap - CSS: Cascading Style Sheets - MDN Web Docs
Note: In contrast to word-break , overflow-wrap will only create a break if an entire word cannot be placed on its own line...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’ll need to use
table-layout: fixed
. Automatic table layout always gives cells at least the minimum size of their content without taking care ofoverflow-wrap:break-word
or hyphenation (and I think that it’s a good idea, even if it’s strange in this case). Other browsers (at least Chrome and Epiphany) give the same rendering as WeasyPrint.Tables as always: special beasts. Indeed,
table-layout: fixed
does the trick with all of my Pangos.