r/webdev•
HaydnH

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.

Posted Aug 3, 2026, 6:12 PM UTC

37

Comments aren't archived yet

This post had 7 comments on Reddit. Comments for this period haven't been loaded into the archive yet.