AutoGrow Textareas with CSS

Because the calls for of the online change and builders experiment with completely different consumer experiences, the necessity for extra native language enhancements expands. Our presentation layer, CSS, has performed extremely properly in enhancing capabilities, even when typically too sluggish. The necessity for native help for robotically increasing textarea parts has been lengthy identified…and it is lastly right here!

To permit textarea parts to develop vertically and horizontally, add the field-sizing property with a price of content material:

textarea {
  field-sizing: content material; // default is `fastened`

The default worth for field-sizing is fastened, signaling present conduct. The brand new conduct, content material, will develop as a lot as attainable. To constrain the dimensions a textarea can develop, use conventional width/max-width and top/max-height properties.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Back to top button