I want to create a fixed sized text area which cannot be dragged to change the size. How can I make a text area fixed size in Twitter Bootstrap
. How can its size be fixed? By fixed size I mean fixed number of cols and rows.
I went through the documentation but didn't get any clue.
Definition and Usage The <textarea> element is often used in a form, to collect user inputs like comments or reviews. A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier). The size of a text area is specified by the cols and rows attributes (or with CSS).
Try textarea {max-width:95%;} - it will always fit your display. Show activity on this post. I set the number of columns to slightly greater that the width of the div on a large screen and as the screen gets smaller it acts responsive to the screen size.
It can be achieved by using JavaScript and jQuery. Method 1: Using JavaScript: To change the height, a new function is created which changes the style property of the textarea. The height of the textarea is first set to auto. This value makes the browser set the height of an element automatically.
Add this to your CSS:
textarea { resize:none; }
or this for fixed width (and keep vertical resizing):
textarea { resize:vertical; }
Note that this is not supported by opera and internet explorer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With