AutoGrow Textareas with CSS


Because the calls for of the online change and builders experiment with completely different person experiences, the necessity for extra native language enhancements expands. Our presentation layer, CSS, has carried out extremely properly in bettering capabilities, even when generally too gradual. 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 `mounted`
}

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


Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox