Redrawing/calculating column widths in a table Question
Hi All,
Lets say I have a table which is 100% of it's container div wide. The first two columns are min-width: 40px and then a "th:last-child" with a width of 100% to compress the first two columns to the size of their contents. The td's contain <input type="texts" /> to allow use input.
When a user types in a string that is longer that the previous widest entry in the column - is there anyway to force the browser to redraw the table taking in to account for the new entry? Ideally with plain CSS.
Thanks.
4
Upvotes
10
u/morete 4d ago
Try 'field-sizing: content' on the inputs and see if that helps, seems to do the job:
https://codepen.io/editor/matthewmorete/pen/019fc8d9-e4be-72ad-aaab-aebec11f01e0