Monday, December 18, 2023
HomeProgrammingAutoGrow Textareas with CSS

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 finished extremely properly in bettering capabilities, even when generally too sluggish. The necessity for native help for mechanically 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 habits. The brand new habits, content material, will broaden as a lot as potential. To constrain the dimensions a textarea can develop, use conventional width/max-width and peak/max-height properties.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments