How to make auto height textarea ? How to do without a plug and beautiful?
- oneWhat 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
Without javascript is impossible. Take here: http://www.jacklmoore.com/autosize/
- Thanks but I need no plugins - KYRAN
- Well, take the code itself: github.com/jackmoore/autosize/blob/master/dist/autosize.js what else do you need? To write the same code here? - IonDen
- This task does not have such a simple solution. - IonDen
- Aaaa I understood thanks !!! - KYRAN
|
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 ♦
|