input autosize html code example
Example 1: input width autosize
<input id="txt"
type="text"
onkeypress="this.style.width = (this.value.length + 1) + 'em';">
Example 2: autosize input css
onkeypress="this.style.width = (this.value.length + 1) + 'em';"