I am trying to have a div
wrapping a span
element in this way:
----------
|Sentence|
----------
-----------------
|It's a looooong|
|sentence |
-----------------
It works for short sentences but not for long because the end result is like:
----------------------
|It's a loooong |
|sentence |
----------------------
The code is like:
.div-with-border {
display: inline-block;
border: 1px solid red;
}
.div-with-border span {
display: block;
}
table{
width: 100px;
font-size: 16px;
}
<table>
<tr>
<th width="50%"></th>
</tr>
<tr>
<td>
<div class="div-with-border">
<span>Sentence</span>
</div>
</td>
</tr>
<tr>
<td>
<div class="div-with-border">
<span>It's a loooooong sentence</span>
</div>
</td>
</tr>
</table>
I basically want to remove the blank gap that exists between the word break and the right limit of the div
edge, as shown in the example above.