Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.6/ace.js"></script>

<div id="editor1_wrapper" class="app_editor_wrapper">
	<div id="editor1" class="app_editor">echo "Hello";</div>
	<div id="editor1_dragbar" class="app_editor_dragbar"></div>
</div>
<br><br><br>
<div id="editor2_wrapper" class="app_editor_wrapper">
	<div id="editor2" class="app_editor">echo "Hello 2";</div>
	<div id="editor2_dragbar" class="app_editor_dragbar"></div>
</div>
              
            
!

CSS

              
                body {
  margin: 40px;
}

.app_editor {
  height: 300px;
}

.app_editor_wrapper {
	background-color: #cccccc;
	border-bottom: 1px solid #222222;
}

.app_editor_dragbar {
	background-color: #222222;
	width: 100%;
	height: 2px;
	cursor: row-resize;
	opacity: 1;
}
              
            
!

JS

              
                var aceEditorInstance = ace.edit( "editor1" );
var aceEditorInstance2 = ace.edit( "editor2" );

aceEditorInstance.setTheme("ace/theme/monokai");
// inline must be true to syntax highlight PHP without opening <?php tag
aceEditorInstance.getSession().setMode( { path: "ace/mode/php", inline: true } );

aceEditorInstance2.setTheme("ace/theme/monokai");
// inline must be true to syntax highlight PHP without opening <?php tag
aceEditorInstance2.getSession().setMode( { path: "ace/mode/php", inline: true } );

/**
 * Global variable to store the ids of the status of the current dragged ace editor.
 */
window.draggingAceEditor = {};

function makeAceEditorResizable(editor){
    var id_editor = editor.container.id;
    var id_dragbar = id_editor + '_dragbar';
    var id_wrapper =  id_editor + '_wrapper';
    var wpoffset = 0;
    window.draggingAceEditor[id_editor] = false;

    var action_mousedown = function(e) {
        e.preventDefault();

        window.draggingAceEditor[id_editor] = true;

        // Set editor opacity to 0 to make transparent so our wrapper div shows
        document.getElementById(id_editor).style.opacity = 0;
    
        document.addEventListener("mousemove", action_document_mousemove);
    };

    var action_document_mousemove = function(e){
        var _editor = document.getElementById(id_editor);
        var rect = _editor.getBoundingClientRect();

        var rsl = {
            top: rect.top + document.body.scrollTop
        };

        var top_offset = rsl.top - wpoffset;

        var actualY = e.pageY - wpoffset;

        // editor height
        var eheight = actualY - top_offset;
        
        // Set wrapper height
        document.getElementById(id_wrapper).style.height = eheight;
        
        // Set dragbar opacity while dragging (set to 0 to not show)
        document.getElementById(id_dragbar).style.opacity =  0.15;
    };

    document.getElementById(id_dragbar).addEventListener("mousedown", action_mousedown);
 
    var action_mouseup = function(e){
        if (window.draggingAceEditor[id_editor])
        {
            var ctx_editor = document.getElementById(id_editor);
            
            var rect = ctx_editor.getBoundingClientRect();

            var rsl = {
                top: rect.top + document.body.scrollTop
            };

            var actualY = e.pageY - wpoffset;
            var top_offset = rsl.top - wpoffset;
            var eheight = actualY - top_offset;
            
            document.removeEventListener("mousemove", action_document_mousemove);
            
            // Set dragbar opacity back to 1
            document.getElementById(id_dragbar).style.opacity = 1;
            
            // Set height on actual editor element, and opacity back to 1
            ctx_editor.style.height = eheight + "px";
            ctx_editor.style.opacity = 1;
            
            // Trigger ace editor resize()
            editor.resize();

            window.draggingAceEditor[id_editor] = false;
        }
    };

    document.addEventListener("mouseup", action_mouseup);
}

makeAceEditorResizable(aceEditorInstance);
makeAceEditorResizable(aceEditorInstance2);




              
            
!
999px

Console