質問

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