Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable vertical scrolling on textarea

Tags:

html

css

I have a textarea that I want to enable vertical scrolling. When I exceed the height of the textarea, it increases in size. The scroll bar does not appear. I want that a vertical scroll bar appears and the users are not able to resize the text area as well.

I searched online and tried solutions posted, but none seem to work.

Demo: http://jsfiddle.net/hozefa/8fv6e/

CSS:

#imageURLId{
font-size: 14px;
font-weight: normal;
resize: none;
overflow-y: scroll;
}

HTML:

<label for="aboutDescription" id="aboutHeading">About</label>
<textarea rows="15" cols="50" id="aboutDescription"
    style="resize: none;"></textarea>
<a  id="imageURLId" target="_blank">Go to
    HomePage</a>
like image 571
Hozefa Avatar asked Dec 20 '11 19:12

Hozefa


People also ask

How do I make my text area scrollable?

To change the properties of the text box, select the text box and then click Properties. The Properties sheet appears. You will want to change the EnterKeyBehavior, MultiLine and ScrollBars properties. Set the ScrollBar property to Both, Horizontal, Vertical etc according to your own needs.

How do I enable scroll disabled in textarea?

the easiest way would be to use "readonly" instead. another way would be to use a fixed-height div will overflow:scroll that looks like a textarea but isn't.

How do I add a scrollbar to a text box in HTML?

Approach: To create a responsive scroll box, add a <div> tag and then proceed to create the scroll box. All you need to do is to choose the height and width of the scroll box (make sure that the height of your box is short enough so that you have an overflow of the text, allowing box to scroll down.


Video Answer


2 Answers

Try this. It is another version of the answers.

#imageURLId {
  font-size: 14px;
  font-weight: normal;
  resize: none;
  overflow-y: scroll;
}
<label for="aboutDescription" id="aboutHeading">About</label>
<textarea rows="15" cols="50" id="aboutDescription" style="max-height:100px;min-height:100px; resize: none"></textarea>
<a id="imageURLId" target="_blank">Go to
    HomePage</a>
like image 150
Royi Namir Avatar answered Oct 18 '22 22:10

Royi Namir


You can try adding:

#aboutDescription
{
    height: 100px;
    max-height: 100px;  
}
like image 18
Mike Christensen Avatar answered Oct 19 '22 00:10

Mike Christensen