width fit content input 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';">