So I am working on a form. And part of how I want the form to function requires a select box and an input(text) box in the same tr. The other items in that tr are just text boxes. I am having a problem getting the text box that shares a tr with the select to go to where the solo text box goes. Therefore, the right edges do not line up.
What I am looking for...
1) I want the text boxes that are solo to fill the box, ideally without adding width. I am fine with a min width of 550px, but not necessary.
2) I want the text boxes that are with the select to fill the rest of the box, meeting the same edge as the solo boxes. Satisfying OCD...
CSS for the table:
table, th, td {
border: 1px solid var(--main-color);
padding: 6px 8px;
white-space: nowrap;
}
table {
border-collapse: collapse;
table-layout: fixed;
}
thead {
background-color: #333;
border-bottom: 3px solid var(--main-color);
}
thead th, thead a, thead a:visited {
color: white;
}
th.active {
background: var(--main-color);
}
table > :not(thead) tr th {
background-color: #333;
border-right: 3px solid var(--main-color);
color: white;
text-align: right;
}
tr {
height: auto;
}
td {
color: black;
}
table input {
width:100%; /* simply scale inputs to table cell size */
}
td.input-group input {
width:auto; /* but not for radios or checks */
}
HTML (shortened, just one solo text box and one that is sharing with the select):
<table>
<tr>
<td>Serial Number: </td>
<td><input type="text" name="device-serial-number" maxlength="8" required></td>
</tr>
<tr>
<td>MAC Address NIC: </td>
<td>
<select name="media-nic">
<option value="">Media</option>
<option value="eth">Ethernet</option>
<option value="inf">Infiniband</option>
<option value="fib">Fiber</option>
</select>
<input type="text" name="mac-nic" maxlength="17">
</td>
</tr>
</table>
Fiddle with more CSS and such: https://jsfiddle.net/2o0sn4ep/