Question

My requirement is this. I need a text box with a width of 5px. As I type something on it the width should be increased. Is it possible to do using CSS only without js

thnx

Was it helpful?

Solution

ATM this is not possible with CSS only.

To achieve this you would have to check the current content width of the textfield on every keystroke in it (use the onKeyUp event of it) and then change the textbox' width accordingly.

OTHER TIPS

hmm i only know like this one..

<script language="javascript">
function expand_textbox(s)
{
    s.size = s.size + 1;
}
</script>

<input type="text" size="20" name=txt onkeyup="expand_textbox(this)" >

try it..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top