.CodeMirror {
border: 1px solid #eee;
height: auto;
}
.CodeMirror-scroll {
overflow-y: hidden;
overflow-x: auto;
By setting a few CSS properties, and giving the viewportMargin a value of Infinity, CodeMirror can be made to automatically resize to fit its content.
viewportMargin
Infinity