I try to follow the explication here : How to wrap table cell at a maximum width in full width table
But I can't make something works to wrap my "xxxxxxxxxxxxx" line.
<table class="my-list table table-bordered table-hover">
<tbody>
<tr>
<th>User id</th>
<th>User name</th>
<th>Type</th>
<th>Id</th>
<th>Ad content</th>
<th>Created at</th>
</tr>
<tr>
<td>66666</td>
<td>John Smith</td>
<td>type1</td>
<td>99999</td>
<td>
<div>
Good content with words and real sentences.
</div>
</td>
<td>2015-09-02</td>
</tr>
<tr>
<td>777777</td>
<td>Martin Isabelle</td>
<td>type2</td>
<td>888888</td>
<td>
<div>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</div>
</td>
<td>2015-09-02</td>
</tr>
</tbody>
</table>
https://jsfiddle.net/jfmqgh20/2/
updated link
Css Code:
table {
width: 100%;
}
td {
text-align: right;
white-space: nowrap;
}
td div {
white-space: normal;
word-break: break-all;
display: block;
}
you needed to give the table cell a min and max width not the table head.
.my-list {
max-width: 100%;
}
th {
}
td {
max-width: 300px;
min-width: 150px;
word-wrap: break-word;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With