get a text input to shrink with page css code example
Example: input width autosize
<input id="txt"
type="text"
onkeypress="this.style.width = (this.value.length + 1) + 'em';">
<input id="txt"
type="text"
onkeypress="this.style.width = (this.value.length + 1) + 'em';">