Is there a way to make text fit the size of a textarea as you input it?

So I wouldn’t want the textarea to change size

But I wouldn’t want any scrollbar to appear

I just want the text to get small if it exceeds the size of the textarea. And then bigger again if you delete any of it

I tried googling this, but I am clearly entering the wrong words because all the results just talk about making the textarea grow

I’m not sure this would be a good strategy. Are you going to put a maximum limit on the amount of text the user can enter? If not, then the more text they enter the smaller you’ll make it to the point that they won’t be able to read it. Also, people can manually increase the size of the text in their browsers, so you need to allow that vertical scroll bar to appear to compensate for that.

Just curious, why don’t you want the scroll bar to appear?

In answer to your question, you could probably use the onchange event to do this. That would fire every time a change is made to the text. You would have to come up with the logic to figure out if you needed to make the text smaller.

I’m making a tool to help the user create DND character sheets.

If you find a fillable PDF online, you will notice that the text size changes in certain parts as you enter more text

This is to accommodate an A4 page when you print it out

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.