<form action="" method="">
<input name="title" type="text" maxlength="256" value="daniel"/>
<input name="description" type="text" maxlength="512" value="awesome"/>
</form>
JavaScript:
function resize(elem){
if(!elem.value.length) elem.size=1;
else elem.size=elem.value.length;
}
var elem=document.getElementsByTagName('input');
for(i in elem){
elem[i].addEventListener('keyup', function(){resize(this);}, false);
resize(elem[i]);
}
CSS:
input{
display:block;
font-size:12px;
}
all of this is working, but i am not quite satisfied. as you can see actual text representation is quite smaller than text field boundaries. this is pronounced as text gets longer. is there any css trick to minimize this offset?
you can check example page HERE
many thanks!