Click here to Skip to main content
14,425,416 members
Rate this:
Please Sign up or sign in to vote.
See more:
when i type in inputbox it type in div.and take full width of div. i type one character it take full width of div. and type multiple character it take full width of div

What I have tried:

i try keyup function it work properly but it not take take equal width to fontsize and div...
Updated 17-May-19 2:11am
phil.o 17-May-19 7:47am
Have you tried to use a span instead of a div. By default div has its display attribute set to block, whereas span has its display attribute set to inline.
Member 14362210 17-May-19 7:53am
i use span now it work but i also take width to span and adjust font size depend on span width
DerekT-P 17-May-19 11:41am
Please clarify what you're trying to achieve. I'm guessing that you have a fixed-width DIV containing a text box; what you want is that when you type into the textbox, the font-size is adjusted so that the text fully fills the width of the div? (so the more characters you type, the smaller the text gets; and a single "W" is in a much smaller font than a single "l" for instance...

If so, google "dynamic adjust font size css to fit" and you'll quickly find a number of solutions...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100