Answers for "html text input size auto fit"

2

input width autosize

<input 	id="txt" 
		type="text" 
        onkeypress="this.style.width = (this.value.length + 1) + 'em';">
Posted by: Guest on October-26-2020
1

input text expand to fit content

<style>
.growable-input{
    border: solid 1px black;
}
</style>
<span class="growable-input" contenteditable="true">input value here</span>
Posted by: Guest on April-16-2021

Browse Popular Code Answers by Language