Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource


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


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.


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.



  <svg viewBox="0 0 200 200" xmlns="" style="width: 300px;">
      div {
        font: 18px serif;
        height: 100%;
    <!-- some other SVG -->
    <polygon points="5,5 195,10 185,185 10,195" />

    <foreignObject id="fobject"  x="20" y="20" width="160" height="160" style="background: lightcoral">
      <div id="innerdiv" xmlns="" style="width: 50px; height: 50px; background-color:aqua;">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis mollis
        mi ut ultricies. Nullam magna ipsum, porta vel dui convallis, rutrum
        imperdiet eros. Aliquam erat volutpat.




                function init() {

  myDiagram = new go.Diagram("myDiagramDiv",  // create a Diagram for the DIV HTML element
      "undoManager.isEnabled": true  // enable undo & redo

  // define a simple Node template
  myDiagram.nodeTemplate =
    new go.Node("Auto")  // the Shape will go around the TextBlock
      .add(new go.Shape("RoundedRectangle", { strokeWidth: 0, fill: "white" })
        // Shape.fill is bound to
        .bind("fill", "color"))
      .add(new go.TextBlock(
        { margin: 8, font: "bold 14px sans-serif", stroke: '#333' }) // Specify a margin to add some room around the text
        // TextBlock.text is bound to
        .bind("text", "key"));

  // but use the default Link template, by not setting Diagram.linkTemplate

  // create the model data that will be represented by Nodes and Links
  myDiagram.model = new go.GraphLinksModel(
      { key: "Alpha", color: "lightblue" },
      { key: "Beta", color: "orange" },
      { key: "Gamma", color: "lightgreen" },
      { key: "Delta", color: "pink" }
      { from: "Alpha", to: "Beta" },
      { from: "Alpha", to: "Gamma" },
      { from: "Beta", to: "Beta" },
      { from: "Gamma", to: "Delta" },
      { from: "Delta", to: "Alpha" }

  document.getElementById('button').addEventListener('click', function() {
    // do something on button click

} // end init