How to make auto height textarea ? How to do without a plug and beautiful?

  • one
    What do you mean by autosize? Filling the block height by 100% or auto-expansion? - Cyrus
  • @Cyrus Auto change textarea height when entering text - KYRAN

2 answers 2

Without javascript is impossible. Take here: http://www.jacklmoore.com/autosize/

And to use contenteditable not suitable?

 .editor { border: 1px solid; padding: .2em; white-space: pre; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; } .editor:empty:after { content: ""; } .editor * { all: inherit !important; /* Для тех, кто не умеет all (вероятно, надо дополнить) */ color: inherit !important; background: none !important; white-space: pre !important; line-height: inherit !important; /* Переопределение .editor */ padding: 0 !important; border: none !important; outline: none !important; resize: none !important; display: inline !important; } .editor div { display: block !important; } 
 <div contenteditable class=editor></div> 

  • @KYRAN, the answer is updated. Fixed jambs with the display property. But on cross-browser compatibility this should be checked very carefully anyway. - Qwertiy