I use this code
Initialize new codemirror element in HTML/JS:
<body>
<div id="code"></div>
<script>
var editor = CodeMirror(document.getElementById('code'), {
lineNumbers: true,
lineWrapping: false,
matchBrackets: true,
closeBrackets: true,
autoCloseBrackets: true,
styleActiveLine: true,
mode: "text/x-csrc",
});
</script>
</body>
Set height for codemirror in CSS:
.CodeMirror {
font-size: 1em;
float: left;
width: 100%;
height: 100%;
}
.cm-wrap { height: 100% }
.cm-scroller { overflow: auto }
But codemirror only fills 50% of the height. Why and how to fix this?