How do i resize my textarea vertically in IE?
I did resize: vertical and it works well in Firefox but in IE it doesn't work. So what's the alternative for this?
Also, if I want to print the page, then I need the textarea to extend and print the whole contents in the box. What should I use for this?
edited -
My CSS:
@media screen {
textarea {
resize: vertical;
overflow: auto;
border: 1px #999999 solid;
padding: 6px;
background: #ffffff url('../images/field_bg.png') repeat-x bottom;
width: 400px;
height: 100px;
}
}
@media print {
textarea {
border: 1px #999999 solid;
padding: 6px;
background-color: #ffffff;
background-image : none;
width: 400px;
height: auto;
overflow: visible;
}
}
.field {
display: inline;
vertical-align: top;
width: 25%;
}
HTML -
<div class="field">
<textarea id="xp">
some text here
</textarea>
</div>
Edited -
I still can't figure out the solution for this. Can anybody help please?
# Auto Resize a `<textarea>` with an `autosize` Attribute First, a regular `<textarea>`. <textarea>Will NOT auto resize. </textarea> Now add an attribute to tell the element to automatically resize on input, i.e. `<textarea autosize>`. <textarea autosize>Will auto resize.
A simple way to ensure that the control is not resizable is to add an explicit style="resize: none;" attribute on the textarea element using the HTML Form Element Attributes property.
Resize a text box Select the text box. Select one of the handles and drag until the text box is the size you want.
How do you make a text area a fixed size? To prevent a text field from being resized, you can use the CSS resize property with its "none" value. After it you can use the height and width properties to define a fixed height and width for your <textarea> element.
The css resize property is not (yet) supported by IE. You may want to try this jquery ui plugin: http://jqueryui.com/demos/resizable/. Here's a fiddle to demonstrate.
For your second question regarding printing in IE. Try add the following CSS to the media="print" block:
textarea {
overflow: visible;
}
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