JavaScript Mapping Library
As the demands of the web change and developers experiment with different user experiences, the need for more native language improvements expands. Our presentation layer, CSS, has done incredibly well in improving capabilities, even if sometimes too slow. The need for native support for automatically expanding textarea elements has been long known…and it’s finally here!
textarea
To allow textarea elements to grow vertically and horizontally, add the field-sizing property with a value of content:
field-sizing
content
textarea { field-sizing: content; // default is `fixed` }
The default value for field-sizing is fixed, signaling current behavior. The new behavior, content, will expand as much as possible. To constrain the size a textarea can grow, use traditional width/max-width and height/max-height properties.
fixed
width/max-width
height/max-height
The post AutoGrow Textareas with CSS appeared first on David Walsh Blog.
David Walsh Blog
You must be logged in to post a comment.
This site uses Akismet to reduce spam. Learn how your comment data is processed.