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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <textarea id="cm" name="cm"></textarea>

              
            
!

CSS

              
                
              
            
!

JS

              
                CodeMirror.defineSimpleMode("simplemode", {
    start: [
        {
            regex: /["'](?:[^\\]|\\.)*?(?:['"]|$)/,
            token: "string"
        },
        // You can match multiple tokens at once. Note that the captured
        // groups must span the whole string in this case
        {
            regex: /(function)(\s+)([a-z$][\w$]*)/,
            token: ["keyword", null, "variable-2"]
        },
        {
            regex: /[(?:buy the|send the|check the)]*\b/i,
            token: "keyword"
        }
    ],
    // The multi-line comment state.
    comment: [
        {
            regex: /.*?\*\//,
            token: "comment", next: "start"
        },
        {
            regex: /.*/,
            token: "comment"
        }
    ],
    // The meta property contains global information about the mode. It
    // can contain properties like lineComment, which are supported by
    // all modes, and also directives like dontIndentStates, which are
    // specific to simple modes.
    meta: {
        dontIndentStates: ["comment"],
        lineComment: "//"
    }
});

var listKeywords = ["Buy the","Send the", "Check the"];
// Register an array of completion words for this mode
CodeMirror.registerHelper("hintWords", "simplemode", listKeywords);

var editor = CodeMirror.fromTextArea(document.getElementById('cm'), {
    mode: "simplemode",
    lineNumbers: true,
    extraKeys: {"Ctrl-Space": "autocomplete"}
});
              
            
!
999px

Console