Customize Textarea Resizing with CSS
Webkit-based web browsers like Safari and Chrome have led web innovation the past few years. Whether its implementing new JavaScript APIs, providing more CSS capabilities than other browsers, or simply providing blazing-fast page rendering, WebKit has been head and shoulders above other browsers in page control and CSS features. One of those subtle features is the ability to control textarea resizing. FireFox will provide this same capability in Firefox 4. Let me show how to control textarea resizing with CSS.
The CSS
Textarea resize control is available via the CSS3 resize property:
textarea { resize:both; } /* none|horizontal|vertical|both */
textarea.vert { resize:vertical; }
textarea.noResize { resize:none; }
Allowable values self-explanatory: none (disables textarea resizing), both, vertical and horizontal. The default in Firefox, Safari, and Chrome is both.
If you want to constrain the width and height of the textarea element, that's not a problem: these browsers also respect max-height, max-width, min-height, and min-width CSS properties to provide resizing within certain proportions:
#confinedSpace textarea { resize:vertical; max-height:300px; min-height:200px; }
#confinedSpace textarea.horiz { resize:horizontal; max-width:400px; min-width:200px; }
Textarea resizing is hugely helpful when you're looking to post a long message. Of course sometimes you may want to disable textarea resizing to accommodate a design, and that's fine too. As a general rule, however, you should allow resizing.
Comments
Be Heard!
Share your thoughts without being a jerk! And wrap your code in <code> tags, f00!
text area deyince bende bişi anlatacak sandım
thank, don’t lnow about resize in css
Thank you very much! I didn’t know this css attribute. Is it supportet by IE?
Just did an IE10 check and textarea resizing is still not supported.
No, IE will not support Resize. Check (http://www.impressivewebs.com/css3-support-ie9/) for a table with what CSS3 attributes are supported. Best to stick with jQuery to get cross-browser compatibility if you want to implement this.
It work’s on Both Firefox and IE9.
i.e.
.textareaResize { resize:none;} in CSS class.
I found a page that has a liquid jquery textarea that looks good.
http://www.ajaxera.com/jquery-sexy-tools-textarea/
I do not recommend the use of Internet Explorer because it is very stupid
I try “resize: vertical” and it works in Firefox (8), but it doesn’t work in Chrome (15) and Safari.
I hate IE, never do what I want
I think that IE is the worst browser ever.