-1

example input

So I have a table like this:

<table>
  <tr>
    <th>
      <span>label1</span><br/>
      <input type='text' placeholder='filter' />
    </th>
    <th>
      <span>label2</span><br/>
      <input type='text' placeholder='filter' />
    </th>
  </tr>
  <tr>
     <td>short</td>
     <td>a very long one</td>
  </tr>
</table>

How to make the input to auto-fit the content of the column, so that the short column will be small in width, and the column with long content will be stretch

already tried min-width: 4em it still have fixed size for the input text.

tried with max-width: 4em the size of td still seems stretched even when all of other columns are short in width

stretched td

width: 100% on input also didn't work

100% width

width: 0; min-width: 100% also didn't work

`width 0, min-width 100%

Kokizzu
  • 24,974
  • 37
  • 137
  • 233

0 Answers0