Sobsno is on the Input page, I want to make sure that by default it only has a placeholder, and when I enter it, I need it to track its content and, if necessary, increase / decrease its height. How to achieve this?

  • one
    Height? Does the font change? - user207618
  • no, is it possible to stir up the <input type = "text" />, so that it makes hyphenation and, accordingly, increases / decreases its height? - Chamond
  • Then you to textarea , it is for this and created. - user207618
  • @Other, but multiline text can be entered into texarea. In addition, it is also so-so monitors the size. - Qwertiy
  • @Qwertiy, well, transfers to input cannot be done if needed - textarea will help. And so - it is unclear what the author needs. - user207618

2 answers 2

You can use the usual div with contenteditable=true and display: inline-block style.

 div { border: 1px solid #aaa; padding: 5px; border-radius: 3px; width: 100px; display:inline-block; } 
 <div contenteditable=true></div> 

  • If we are to do contenteditable , then so , only with white-space: normal . - Qwertiy
  • @Qwertiy I don’t understand what the difference is then. Do you have .editor * styles .editor * for cross-browser compatibility or what is it? - Sasha Omelchenko
  • one
    In order to avoid this: i.stack.imgur.com/nsC3d.gif - Qwertiy

maybe in CSS

 input{ height:auto; } 
  • Yah? And check. - Qwertiy