I would like to put a label and an input[type=text] on the same line, and I would like for the input‘s width to fill the remaining width of the containing element, regardless of the length of the label’s text (see first image).
I tried to use width: auto; for the input, but it seems to have a static width. I also tried width: 100%;, but that moves the input to a new line (see second image).

How can I achieve this using CSS?
It’s possible without JavaScript, see: http://jsfiddle.net/Khmhk/
This works in IE7+ and all modern browsers.
HTML:
CSS:
The reason why
overflow: hiddenis so magically useful in this instance is explained here.display: table-cellis another option, see: http://jsfiddle.net/Khmhk/1/This works in IE8+ and all modern browsers:
HTML:
CSS: