Вопрос

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

Это было полезно?

Решение

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.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top