Is there a way to create a column in the middle of an HTML table that fills the remaining space with a minimum width of 300px?
Take a look at this JSfiddle for reference.
HTML:
<table>
<tr>
<td class="fixed-width">Fixed width column</td>
<td class="remaining-width-or-300-pixels">
This column contains long content and should fill the remaining space, with a minimum width of 300 pixels. Content can be truncated if needed.
</td>
<td class="fixed-width">Another fixed width column</td>
</tr>
</table>
CSS:
table {
display: table;
width: 100%;
table-layout: fixed;
white-space: nowrap;
color: white;
}
table td {
overflow: hidden;
}
td.fixed-width {
background: blue;
width: 200px;
}
td.remaining-width-or-300-pixels {
background: red;
overflow: hidden;
min-width: 300px;
}
The issue is that when adjusting the column width, min-width: 300px;
doesn't seem to work as expected.
Are there any CSS-only solutions (no javascript) to address this problem?
Edit: Please note that using
div
elements instead oftable
,tr
, andtd
is not an option, as I am utilizing a library that specifically requires the use of thetable
element.