Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active March 13, 2023 18:47
Show Gist options
  • Save MichaelDimmitt/f3343f059eef573704f904d3ff17873f to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/f3343f059eef573704f904d3ff17873f to your computer and use it in GitHub Desktop.

Inputs do not grow but should.

https://stackoverflow.com/questions/7168727/make-html-text-input-field-grow-as-i-type

https://css-tricks.com/auto-growing-inputs-textareas had an interesting solution that requires no library: https://codepen.io/shshaw/pen/bGNJJBE

Simplified here: https://codepen.io/michaeldimmitt/pen/mdGXgjy

In order to be simplified:

  • Content editable needed two spaces to start out
  • This allows the parent element to compensate with the input having a natural padding.

Discuss!! In the comments. If you dare!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment