Dan L.
Dan L.

Reputation: 1747

break word inside a table-cell div

I have the following fiddle: http://jsfiddle.net/nVWt5/ with a structure like:

<table style="table-layout:fixed">
<tr>
<td>
<span style="display:table-cell">
 <div style="word-wrap:break-word;">really_long_text_here_no_spaces</div>
</span>
</td>
</tr>
</table>

How can I make the text wrap without modifying the span's display style? The span cannot be currently changed as it is autogenerated.

Thank you!

Upvotes: 0

Views: 801

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201568

Remove display:table-cell, as it serves no useful purpose here and appears to prevent the wrapping.

A span element cannot contain a div element by HTML rules, so you should really do something to the markup.

Note that contrary to what the names suggest, word-wrap:break-word does not deal with words; instead, it mechanically breaks strings with no regard to rules of human languages.

Upvotes: 2

Related Questions