Pergunta

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

Foi útil?

Solução

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.

Outras dicas

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..

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top