resize.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>CodeMirror 2: Autoresize Demo</title>
  5. <link rel="stylesheet" href="../lib/codemirror.css">
  6. <script src="../lib/codemirror.js"></script>
  7. <link rel="stylesheet" href="../theme/default.css">
  8. <script src="../mode/css/css.js"></script>
  9. <link rel="stylesheet" href="../css/docs.css">
  10. <style type="text/css">
  11. .CodeMirror {
  12. border: 1px solid #eee;
  13. }
  14. .CodeMirror-scroll {
  15. height: auto;
  16. overflow-y: hidden;
  17. overflow-x: auto;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <h1>CodeMirror 2: Autoresize demo</h1>
  23. <form><textarea id="code" name="code">
  24. .CodeMirror-scroll {
  25. height: auto;
  26. overflow-y: hidden;
  27. overflow-x: auto;
  28. }</textarea></form>
  29. <p>By setting a single CSS property, CodeMirror can be made to
  30. automatically resize to fit the content. Use <code>max-height</code>
  31. to prevent it from growing past a given point (on halfway modern
  32. browsers).</p>
  33. <script>
  34. CodeMirror.fromTextArea(document.getElementById("code"), {
  35. lineNumbers: true
  36. });
  37. </script>
  38. </body>
  39. </html>