<!doctype html> <html> <head> <title>CodeMirror 2: Autoresize Demo</title> <link rel="stylesheet" href="../lib/codemirror.css"> <script src="../lib/codemirror.js"></script> <link rel="stylesheet" href="../theme/default.css"> <script src="../mode/css/css.js"></script> <link rel="stylesheet" href="../css/docs.css"> <style type="text/css"> .CodeMirror { border: 1px solid #eee; } .CodeMirror-scroll { height: auto; overflow-y: hidden; overflow-x: auto; } </style> </head> <body> <h1>CodeMirror 2: Autoresize demo</h1> <form><textarea id="code" name="code"> .CodeMirror-scroll { height: auto; overflow-y: hidden; overflow-x: auto; }</textarea></form> <p>By setting a single CSS property, CodeMirror can be made to automatically resize to fit the content. Use <code>max-height</code> to prevent it from growing past a given point (on halfway modern browsers).</p> <script> CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true }); </script> </body> </html>