Stop textarea from resizing when hitting enter

#1

Hi,

I have the following textarea:

<textarea id="description" placeholder="Enter a description" class="textarea" ></textarea>

.description textarea{
	height: 155px;
	margin-top: 0;
}

However, when a user enters text and hits enter a few times, the actual text area box gets taller rather than creating a little scroll bar inside.

How do I stop the textarea from getting bigger and to add the scroll inside?

Thanks!

0 Likes

#2

Where are you seeing this happen?

The above code will limit the textarea to 155px height and a scroll bar will appear as needed.

Can you post an example that does what you say?

0 Likes

#3

I actually managed to figure it out. I needed to add: overflow-y: scroll;

0 Likes

#4

It shouldn’t have been necessary as the default is overflow:auto. It must have been changed somewhere else (unless this is a specific browser issue). :slight_smile:

1 Like

#5

Yes, I think it had some other CSS over-riding it.

1 Like