Make a CodeMirror editor and its gutter 100% height of container

Don P picture Don P · Nov 11, 2014 · Viewed 11.1k times · Source

How do I make a CodeMirror editor and its gutter 100% of the height of its parent?

For example, on jsfiddle, the editors have a 100% height gray gutter.

I've gone through the CSS trying to make everything 100% height, but no effect.

Answer

Marijn picture Marijn · Nov 11, 2014

A CSS rule like .CodeMirror { height: 100%; } should work. Note that when the parent element changes size after the editor has been initialized, you are responsible for calling .refresh() on your CodeMirror instance to make sure it correctly draws itself.