Search code examples
javascriptcodemirror

How to have two CodeMirror editors side by side


I need to have two CodeMirror editors side by side, but they always show after each other.

I tried:

  1. Changing the width CSS property (of the textarea or a parent element, e.g. span).
  2. Use editor.setSize('50%', null)

But couldn't figure it out.

Please see this JSFiddle


Solution

  • Try using float:

    <span style='float: left;'><textarea id='ta1'>First</textarea></span>
    <span><textarea id='ta2'>Second</textarea></span>