How to force a table cell containing an input of type text, to stretch horizontally and be the same width as its child input? (Where the child input is subject to change width, not fixed).
Code below:
.wrap {
width: 100%;
overflow-x: scroll;
}
table {
min-width: 100%;
width: auto;
}
td {
border: 1px solid #000;
padding: 10px;
white-space: nowrap;
}
input {
width: 100%;
}
<div class="wrap">
<table>
<tr>
<td>
<input type="text" value="testing 123 testing 456 testing 789">
</td>
<td>
<span>Column 2 testing 1234567890 testing 1234567890 testing 1234567890</span>
</td>
<td>
<span>Column 3 testing 1234567890 testing 1234567890 testing 1234567890</span>
</td>
</tr>
</table>
</div>
Check it here: As you can see, cells containing spans grow but the one containing the input doesn't.