Search code examples
javascriptcssresizeheightcodemirror

Resizing CodeMirror editor with CSS doesn't work


I have been trying to change the width and height of my Codemirror editor using CSS but it does not seem to have any effect.

.CodeMirror {
   width: 500px;
   height: 1000px;
}

Instead of resizing accordingly it remains at a height of 300px and full width. Nevertheless I am still able to set width and height via code: editor.setSize(500, 1000);

What am I doing wrong?


Solution

  • Make sure to import your own CSS file after the default stylesheets of Codemirror. Otherwise the defaults do not get overridden properly. Simply import your stylesheet last.